Next.js Discord

Discord Forum

Help with dynamic routes

Unanswered
Eulophid wasp posted this in #help-forum
Open in Discord
Eulophid waspOP
Hey there 👋 I'm a beginner
I'm trying to make dynamic routes but I require some assistance!!!

I have created the folder and that dynamics folder [id] but the thing is now I want to add an image how can I access it ??

1 Reply

Cape horse mackerel
Does this help?
(images)
/images/page.tsx // returns an images list
/image/[id]/page.tsx // returns an image


// /images/page.tsx
return {images.map(image => <Link href={`/image/${image.imageId}`}>{image.name}</Link>)}

// /image/[id]/page.tsx
type ImageProps = {
  params: {
    id: string;
  }
}

export default function Image({ id }: ImageProps){
  return <div>{id}</div>
}