Answers for "how to create route using param in next js"

-1

get parameter from next.js route

import {useRouter} from "next/router";

export default function Items() {
  const { query } = useRouter();
  return (
    <div>
      <h1>Items page</h1>
      <p>{query.id}</p>      <p>{query.name}</p>    </div>
  );
}
Posted by: Guest on June-28-2021

Browse Popular Code Answers by Language