I have a function that comes from a parent all the way down to a the child of a child in a component hierarchy. Normally this wouldn\'t be too much of a problem, but I need
I don't see why you would get that error, but you should be doing myFunction={this.myFunction} and myFunction={this.props.myFunction}:
class SomeComponent extends Component{
constructor(props){
super(props);
//does whatever stuff
this.myFunction = this.myFunction.bind(this);
}
//(only applicable to raw and normal forms)
myFunction(param){
console.log('do something: ', param);
}
render(){
return ( )
}
}
class ChildComponent1{
render(){
return ( )
}
}
class ChildComponent2{
render(){
return ()
}
}
Wrapping the function call inside another (arrow) function is just unnecessary and won't forward the parameter properly (since all your intermediate arrow functions do not accept a parameter).