You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to get the active tab which correlates to a matched route.path and have tried using:
constelement=useRoutes([{element: <Profile/>,path: 'profile',title: 'Profile',}])constlocation=useLocation()const[{ route }]=matchRoutes(routes,location)// use route.path as active tab
However, since my routes are nested under '/users/:userId/*', it never matches the routes because location.pathname is '/users/:userId/profile'.
What can I do to get the route matched by nested, relative paths?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am trying to get the active tab which correlates to a matched
route.path
and have tried using:However, since my routes are nested under
'/users/:userId/*'
, it never matches the routes becauselocation.pathname
is'/users/:userId/profile'
.What can I do to get the route matched by nested, relative paths?
Beta Was this translation helpful? Give feedback.
All reactions