Unverified Commit ad1b6310 authored by William Li's avatar William Li Committed by GitHub

add support for changing /route/#hashes (#36079)

update with-google-analytics example to also fire events when the hash section of the URL changes.
parent 7013a8c2
...@@ -10,8 +10,10 @@ const App = ({ Component, pageProps }) => { ...@@ -10,8 +10,10 @@ const App = ({ Component, pageProps }) => {
gtag.pageview(url) gtag.pageview(url)
} }
router.events.on('routeChangeComplete', handleRouteChange) router.events.on('routeChangeComplete', handleRouteChange)
router.events.on('hashChangeComplete', handleRouteChange)
return () => { return () => {
router.events.off('routeChangeComplete', handleRouteChange) router.events.off('routeChangeComplete', handleRouteChange)
router.events.off('hashChangeComplete', handleRouteChange)
} }
}, [router.events]) }, [router.events])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment