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 verbiage "...nearest ancestor route loader" makes me think ascending the route tree for resolved loader data, -exactly how useLoaderData() behaves when used in a component. I thought this would apply to Routes too.
Use case I have in mind is not data-loading (#10616) or composing queries from resolved tributary data (#9188 (comment)). I'm thinking about tabbed interfaces (player/:id/<offense>|<defense>) or wizards (thing/new/<1-of-2>|<2-of-2>) where the underlying data might exist at the :id or new segment respectively, but the leaf views are RRD Routes.
That comment is referring to other components in the tree rendered by the Route's element. It does not cross the Route boundary upwards. The docs make this pretty clear. (Note: You should be reading the docs, not the source code comments. They're not always updated/correct and have fewer people checking them for accuracy.)
What version of React Router are you using?
6.14.1
Steps to Reproduce
(I forked the
Data Router
example)Expected Behavior
The verbiage "...nearest ancestor route loader" makes me think ascending the route tree for resolved loader data, -exactly how
useLoaderData()
behaves when used in a component. I thought this would apply toRoute
s too.Use case I have in mind is not data-loading (#10616) or composing queries from resolved tributary data (#9188 (comment)). I'm thinking about tabbed interfaces (
player/:id/<offense>|<defense>
) or wizards (thing/new/<1-of-2>|<2-of-2>
) where the underlying data might exist at the:id
ornew
segment respectively, but the leaf views are RRDRoute
s.I kinda get what I want doing:
but that doesn't feel right. Maybe I'm not interpreting docs correctly or this is usage question, but I started with a bug report.
Actual Behavior
When I use
useLoaderData()
onRoute
components/elements and don't define a loader, it ascends the tree.The text was updated successfully, but these errors were encountered: