react-redux: can't access children from
Calling React.Children.only()
on a Connect(Component)
generated by the react-redux connect
function does not expose its children.
Here’s a screenshot of calling React.Children.only(component)
on a plain React component:
And here’s one of calling React.Children.only(component)
on a Connect(Component)
generated by the connect function:
I need access to the Connect
children because I have a component wrapper that injects a prop into deeply nested children of a certain type.
Does this make sense?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 15 (8 by maintainers)
That’s not how React works. Components rendered by something are the implementation detail. You can manipulate children that you create in your component, but you can’t use it as an “introspection” tool to manipulate the output of other components.