Created
June 9, 2021 06:11
-
-
Save akellbl4/f945f802738555c1bcb9ff5a14e38fe1 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
// lib/router.js | |
import { useRouter as useNextRouter } from 'next/router' | |
export function useRouter() { | |
const router = useNextRouter() | |
const [pathname, queryString = ''] = router.asPath.split('?') | |
return Object.assign(router, { pathname, queryString }) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment