How do I use parent route loader data in child route component? #979
Unanswered
Silverwolf90
asked this question in
Q&A
Replies: 1 comment 2 replies
-
Would need a reproduction, but off the bat this should work. That being said, I don't try to use |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Every child has the same loader, so I figured I could hoist this loader into the parent's route and access in each child. But I can't seem to figure out how to access this data in simple way/type safe way. Is there a straightforward way to do this out-of-the-box? Or would expected way to wrap an
Outlet
in a react context that contains the loader data and access the context from children?I have tried using the following lines in the child route's component, but I get an "Invariant failed" runtime error in both cases:
Beta Was this translation helpful? Give feedback.
All reactions