I'm new to React Native and I have a component inside a component.
I need to access a function of the parent from the child component. How do I access the parent, e.g. something like this.parentNode.myFunc(); from the child? (of course, without passing it as a prop down the whole view hierarchy)
Send to child component as props. Like that:
<ChildComponent myProp={this.myFunc} />
and then, you can call the function this.props.myProp()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With