Last active
June 9, 2021 06:16
-
-
Save akellbl4/2dfaa41a0fc6b60a0120706b73e13123 to your computer and use it in GitHub Desktop.
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
// pages/params.jsx | |
import { useEffect, useCallback } from 'react' | |
import { useRouter } from 'next/router' | |
function MyComponent() { | |
const { push } = useRouter() | |
const handleClick = useCallback(() => { | |
// some logic | |
push('/profile') | |
}, [push]) | |
useEffect(() => { | |
if (...) { | |
push('/sign-in') | |
} | |
}, [push]) | |
return <>...</> | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment