0

I have a btn in parent component and func in child component

<parent>
  <child/>
  <button onClick={myFunc}>call func</button>
</parent>
<child>
  const myFunc = () => {
    ...
  }
  return{
  }
</child>
  • You pass the function as a prop to the child. So, something like this: ` ` and in the child: `const child = ({...props}) => { return };` – jsN00b Apr 05 '22 at 14:54
  • 1
    Does this answer your question? [Call child method from parent](https://stackoverflow.com/questions/37949981/call-child-method-from-parent) – norbekoff Apr 05 '22 at 14:55

0 Answers0