Last active
December 20, 2023 01:24
-
-
Save sejidjorge/2c98cd87e43282b7819fdf9a5f6be142 to your computer and use it in GitHub Desktop.
exemple next router
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // rota '/register' | |
| export default async function Register(){ | |
| const router = useRouter() | |
| const id = router.query.q | |
| console.log(id) | |
| return( | |
| // ...JSX aqui | |
| ) | |
| } | |
| // fim do '/register' | |
| // rota '/register/login?q=idaleatorio' | |
| export default async function RegisterLogin(){ | |
| const router = useRouter() | |
| const id = router.query.q | |
| console.log(id) | |
| useEffect(() => { | |
| // Always do navigations after the first render | |
| router.push(`/register?q=${id}`) | |
| }, []) | |
| return( | |
| // ...JSX aqui, sugiro um loading | |
| ) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment