Obtenha o parâmetro da rota Next.js

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>
  );
}
Grotesque Giraffe