It's trivial to pass callback functions as props to child components, but not vice versa.
How do we call instance methods of a child component?
From <Parent /> component, I need to call this.bar instance method of <Child /> component.
class Parent extends React.Component {
render() {
return (
<Child />
)
}
}
class Child extends React.Component {
constructor( props ) {
super( props );
this.bar = () => console.log('foo');
}
}