Skip to content

Instantly share code, notes, and snippets.

@sejidjorge
Last active December 20, 2023 01:24
Show Gist options
  • Select an option

  • Save sejidjorge/2c98cd87e43282b7819fdf9a5f6be142 to your computer and use it in GitHub Desktop.

Select an option

Save sejidjorge/2c98cd87e43282b7819fdf9a5f6be142 to your computer and use it in GitHub Desktop.
exemple next router
// 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