comparing Router props to Link props is pretty confusing #16762
Unanswered
stefanprobst
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
When writing a generic
NavLink
component, i have found that matching aLink
shref
andas
props with the current route (e.g. to setaria-current
) is a bit confusing with next.js. Are these the equivalents between Router props and Link props?router.pathname
href.pathname
new URL(router.asPath, 'http://dummy.net').pathname
(as ?? href).pathname
router.query
href.query
new URL(router.asPath, 'http://dummy.net').hash
href.hash
Beta Was this translation helpful? Give feedback.
All reactions