Next.js Discord

Discord Forum

when should i use router.push('/login') and redirect('/login') in nextjs 13 app dir?

Answered
useless posted this in #help-forum
Open in Discord
as the title said, nothing to be added.
Answered by Africanized honey bee
redirect can be used in server components, but router.push requires invoking the useRouter hook first which can only be done in client components
View full answer

2 Replies

Africanized honey bee
redirect can be used in server components, but router.push requires invoking the useRouter hook first which can only be done in client components
Answer