Navigating from client component to server component
Answered
Dovekie posted this in #help-forum
DovekieOP
I'm rendering a table and I want to make it so when a user clicks on a row it gets navigated to
The table is ofc a client component and the
I've tried using
What is the proper way to do this ?
/campaigns/{campaignIdOfRow}The table is ofc a client component and the
/campaigns/{campaignIdOfRow} a server component.I've tried using
<Link/> or router.push() from next/navigation but they won't perform the navigation.What is the proper way to do this ?
Answered by riský
can you show an example of code that doesn't work (as it works well for me)
4 Replies
I would think both Link and router push should work. Those are the proper ways.
@Dovekie I'm rendering a table and I want to make it so when a user clicks on a row it gets navigated to `/campaigns/{campaignIdOfRow}`
The table is ofc a client component and the `/campaigns/{campaignIdOfRow}` a server component.
I've tried using `<Link/>` or `router.push()` from `next/navigation` but they won't perform the navigation.
What is the proper way to do this ?
can you show an example of code that doesn't work (as it works well for me)
Answer
DovekieOP
Oh this was my bad guys, I just realised that I had a dumb little mistake in my code. Thanks for the replies!
yaya, it works 🎉