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
An alternative and IMO more clean way to do it would be like this:
class SomeComponent extends Component{
myFunction = param => {
console.log('do something: ', param);
}
render(){
return (
)
}
}
class ChildComponent1{
render(){
return ( )
}
}
class ChildComponent2{
render(){
const { onClick } = this.props // destructure
return ()
}
}