Next.js Discord

Discord Forum

<Link> component to append a new /route?

Answered
Da_v_id posted this in #help-forum
Open in Discord
Hi is it possible to append /add to my current route rather than replace the entire route?
Answered by B33fb0n3
then you can still do like this:
<Link href={dynamicParam + "/add"}>Navigate</Link>
View full answer

7 Replies

I guess yes
@James4u I guess yes
oh, i meant to ask how to do it in a server component?
@Da_v_id oh, i meant to ask how to do it in a server component?
yes, you can do that be repeating the one before the new "/add" like this:

you are on: /hello/world/
You want to go to /hello/world/add
And then you can use a link component like:
<Link href={"world/add"}>Navigate</Link>

As you can see, the hello won't be repeated and you are inside a server component
Original message was deleted
then you can still do like this:
<Link href={dynamicParam + "/add"}>Navigate</Link>
Answer
@Da_v_id solved?
yes, thank you!
happy to help