useMatch returns root #148
Unanswered
StephenStrickland
asked this question in
Q&A
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.
-
I've got a basic route setup with no nested routes. I'm wanting to dynamically update my page template with the route's title.
Whenever I try to use
useMatch
in my template component (that's contained within theRouter
declaration) the root route is always returned androute
is always null. I have a workaround by usinguseMatches
that returns all routes that match and I can pull the last route in the list to compute the title.Maybe I misread something, but from the documentation, I expected
useMatch
to always return the current route. Should I set up my routes differently?Routes look like:
Beta Was this translation helpful? Give feedback.
All reactions