Open rkingon opened 4 years ago
Hi,
You are right. Actually using prop children doesn't work.
If you pass the children through another props, it works : https://codesandbox.io/s/reach-router-children-bug-uhk64?fontsize=14&hidenavigation=1&theme=dark.
I encountered this problem before, I thought I had posted an issue but didn't. Thanks for bringing that up ;)
thanks!
yes, for now, i am using a render prop rather than using children.
children prop, however, is easier to iterate / clone.
i think the issue stems from the RouteComponents ability to have a nested structure, as seen here: https://reach.tech/router/api/RouteComponent (section: Children elements, Route Prop)
I see this has been discussed before, but still seems to be an issue ( #248 )
Here is a codesandbox (nav to either
one
ortwo
): https://codesandbox.io/s/reach-router-children-bug-pqei6This sandbox is a very narrow example, in my case I have a real use case for wanting my "Route" to have children and use those children rather than using a prop.