nextjs if user is not logged in redirect code example
Example: next js redirect if not logged in
useEffect(() => {
if (userData.email) {
router.push('/redirect') // redirects if there is no user
}
}, [userData])
useEffect(() => {
if (userData.email) {
router.push('/redirect') // redirects if there is no user
}
}, [userData])