Issue with Multiple Values for params.id in Next.js Dynamic Route
Unanswered
Giant panda posted this in #help-forum
Giant pandaOP
I'm developing a Next.js application with a dynamic route at /instructors/[id]. I'm encountering an issue where the id parameter seems to be read multiple times with different values. Below is the relevant code snippet:
import { api } from '@/trpc/server';
import { InstructorView } from '@/views';
export default async function InstructorPage({
params,
}: {
params: { id: string };
}) {
console.log(params.id);
return <InstructorView.Instructor />;
}1 Reply
@Giant panda I'm developing a Next.js application with a dynamic route at /instructors/[id]. I'm encountering an issue where the id parameter seems to be read multiple times with different values. Below is the relevant code snippet:
tsx
import { api } from '@/trpc/server';
import { InstructorView } from '@/views';
export default async function InstructorPage({
params,
}: {
params: { id: string };
}) {
console.log(params.id);
return <InstructorView.Instructor />;
}
Can you provide a reproduction repo via https://codesandbox.io/ that shows the issue?
Ping me, when you done.
Ping me, when you done.