Created
September 22, 2022 20:46
-
-
Save brandonchadlange/a57a9acc4422c3dca2cb532f61b6954a to your computer and use it in GitHub Desktop.
Messy next.js routing example
This file contains 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
import { useRouter } from "next/router"; | |
const MessyRouter = () => { | |
const router = useRouter(); | |
const { organisation, workspace } = router.query; | |
const route1 = `/${organisation}/${workspace}/route-1` | |
const route2 = `/${organisation}/${workspace}/route-2`; | |
return ( | |
<ul> | |
<li> | |
<a href={route1}>Route 1</a> | |
</li> | |
<li> | |
<a href={route2}>Route 2</a> | |
</li> | |
</ul> | |
); | |
}; | |
export default MessyRouter; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment