class Child extends Component {
componentDidMount() {
this.props.callback();
}
render() {
return (
<div>Child</div>
);
}
}
class Parent extends Component {
onChildDidMount = () => {
console.log('Child component was mounted!');
// do something else
};
render() {
return(
<Wrapper>
<Child callback={this.onChildDidMount} />
</Wrapper>
);
}
}