when should i use router.push('/login') and redirect('/login') in nextjs 13 app dir?
Answered
useless posted this in #help-forum
uselessOP
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 components2 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 componentsAnswer
@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
uselessOP
thank you, now i know why my redirect is not working in the client side.