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
What's the recommended way of passing data from parent to child route?
Let's say I have the following:
/item/$id
/item/$id/foo
/item/$id/bar
I need to fetch some data on /item/$id level so it can be reused on /item/$id/foo and /item/$id/bar.
Using the beforeLoad on /item/$id level and putting it in the route context doesn't seems very optimal, because it blocks the rendering of the whole tree.
Is there a more elegant way to do all this or I should use React context to wrap the children routes?
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.
-
What's the recommended way of passing data from parent to child route?
Let's say I have the following:
I need to fetch some data on
/item/$id
level so it can be reused on/item/$id/foo
and/item/$id/bar
.Using the
beforeLoad
on/item/$id
level and putting it in the route context doesn't seems very optimal, because it blocks the rendering of the whole tree.Is there a more elegant way to do all this or I should use React context to wrap the children routes?
Beta Was this translation helpful? Give feedback.
All reactions