can't access children from <Connect(Component)>
See original GitHub issueCalling 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?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:15 (8 by maintainers)
Top Results From Across the Web
Cant access children in component used as element in Route ...
Fragment components are the only valid children of the Routes component, and other Route components the only valid children of the Route ....
Read more >How to access props.children in a stateless functional ...
Import the child component into the parent component, but instead of invoking it with a self-closing tag, use a standard open/close tag.
Read more >How to access child component properties in Vue.js 3
Accessing components with refs is possible due to the open nature of components in Vuejs2. While in Vuejs 3 components are closed by...
Read more >How to call the child component function from the parent ...
Here we have a parent component with a button and a child component with a function to show an alert. If you want...
Read more >Unable to access parent component value in child js controller ...
and if you want ot pass from connectedCallback then you should refer the same name and it should be used as attribute and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
I found this thread because I’m trying to implement a custom module in react native. For anyone trying to access props.children of a component in react native, try the native methods
- (void)insertReactSubview:(UIView *)subview atIndex:(NSInteger)atIndex
and- (void)removeReactSubview:(UIView *)subview
instead of iterating react elements in javascript