I have two components:
- Parent component
- Child A component
- Child B component
I am unable to understand how to do it. Have gone through Call child component method from parent in react , Call child method from parent and How to call `this.props.children` 's function from parent component? but able to comprehend how to do it.
class Parent extends Component {
  render() {
    return (
      <>
        <button onClick={getAlert()}>Click</button>
        <ChildA />
      <>
      );
    }
  }
class ChildA extends Component {
 
  render() {
    return (
      <ChildB />
    );
  }
}
class ChildB extends Component {
  getAlert() {
    alert('clicked');
  }
 
  render() {
    return (
      <h1>Hello</h1>
    );
  }
}
Is there a way to call the Child's method from the Parent?
