#How do you handle active route states?
12 messages · Page 1 of 1 (latest)
I have a sidebar and I want to add some highlighting on the sidebar items.
For example, home, posts, profile
If I navigate to profile/edit I want my profile item to be highlighted
I can do router.state.location.pathname.startsWith("/profile") and it seem to work
but how do I check dynamic routes like /profile/$username/edit?
Is there a way to do so, or do I have to parse the username in the string before checking?
like: router.state.location.pathname.startsWith(/profile/${usernameVar}/edit)
router.state.matches is typesafe
is this similar as useMatches?
uses same data yes