0

I have two components:

Parent component
Child component

I was trying to call Child’s method from Parent, I tried this way but couldn’t get a result:
class Parent extends Component {
render() {
return (



);
}
}

class Child extends Component {
getAlert() {
alert(‘clicked’);
}

render() {
return (

Hello

);
}
}

Is there a way to call Child’s method from Parent?
Note: Child and Parent components are in two different files.

Kuldeep Baberwal Changed status to publish February 4, 2025