Tengo un problema al leer una cookie en mi navegador... aquí está mi código
const dataA = authService.isLogin(); useEffect(() => { if (dataA) { router.push("/"); } }, [dataA]); ``` the dataA is get a cookie value from my browser.. but thats not working.. it caused my router.push not redirect to the page how can i solve it ?Debe mover dataA al gancho useEffect porque dataA se ejecuta en SSR, no en el navegador, por lo que no puede leer las cookies del navegador. Prueba así:
useEffect(() => { const dataA = authService.isLogin(); if (dataA) { router.push("/"); } }, [dataA]);