redirecting in client component
Unanswered
Havana posted this in #help-forum
HavanaOP
Hi all
What's the correct way to redirect when using the app router, but then having a child component that is a client component?
I've been using nextjs/link for server redirects, but i assume i should use useRouter in this case?
What's the correct way to redirect when using the app router, but then having a child component that is a client component?
I've been using nextjs/link for server redirects, but i assume i should use useRouter in this case?
4 Replies
@Havana Hi all
What's the correct way to redirect when using the app router, but then having a child component that is a client component?
I've been using nextjs/link for server redirects, but i assume i should use useRouter in this case?
yes, you can use for example
router.push to redirect the client in a clientside method to a new route. You can also do that on interaction like using a Link component or anything similar@Havana solved?
HavanaOP
!solved
Sloth bear
Provide code