TanStackT
TanStack3y ago
10 replies
then-purple

Equivalent of useLocation?

Is there an equivalent to useLocation in react-router? I have a parent route with my nav bar and I want to highlight the current tab if the route matches. Do I need to use a dynamic route and get the segment with useParams? Or is there a way to get the pathname from the parent route and check if it matches one of the children?
Screenshot_2023-02-20_at_9.11.32_AM.png
Was this page helpful?