I recently wrote a custom hook* which is serving me well so far.
https://gist.github.com/tim-field/99104278abfad1b8dd94d26717...
I combine this with a simple switch statement in my main component and it does the job.
const [page, setPage] = useRouter('/')
*https://reactjs.org/docs/hooks-custom.html