Next.js Discord

Discord Forum

<Link> href for Normal route after a dynamic one

Answered
Common carp posted this in #help-forum
Open in Discord
Common carpOP
I have the page a/b/[id]. From it I want to continue with a Link component to a/b/[id]/c/d
The app structure is not a problem I have already created it and the page a/b/[id]/c/d exists. I am struggling to create the right href on my Link component.
href="./c/d" sends me to a/b/c/d
Answered by fuma
Generally, we will use:
<Link href={`/a/b/${params.id}/others`}></Link>
View full answer

2 Replies

Generally, we will use:
<Link href={`/a/b/${params.id}/others`}></Link>
Answer
Common carpOP
Cheers, now when you say it it seems obvious. Thanks a lot.