Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
AgentME
on Feb 29, 2016
|
parent
|
context
|
favorite
| on:
React Makes You Sad?
Put ref properties on the child components. Put public methods on the child components. You can then access the refs from the parent in the parent's componentDidMount or componentDidUpdate methods.
kruhft
on Feb 29, 2016
[–]
Tried that, couldn't figure out how to get it to work. Still didn't have access to child's state.
mercurial
on Feb 29, 2016
|
parent
[–]
Use something like:
<YourComponent ref={yourRef => this.yourRef = yourRef}/>
I think you should be able to do this.yourRef.state, but if not, you can always implement a getState() method in YourComponent.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: