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
The useLoaderData hook provides access to the loader data for the current route. However, there’s currently no direct way to get the ID of the current route (useLoaderData uses this internally).
I want to get the immediate parent of the current route, so I want to retrieve the current match from useMatches() by ID (imagine a component that is used in multiple routes and the id changes),
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
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
The useLoaderData hook provides access to the loader data for the current route. However, there’s currently no direct way to get the ID of the current route (useLoaderData uses this internally).
I want to get the immediate parent of the current route, so I want to retrieve the current match from useMatches() by ID (imagine a component that is used in multiple routes and the id changes),
Why not expose useRouteId?
I would like to do this in my code:
Beta Was this translation helpful? Give feedback.
All reactions