0

I am new to the world of React.

Is there a way to register a custom event in the child component and pass the data to the component from its parent component? I know we can pass params through props or state but I am looking something related to events.

Example:

Child Component:

const onCustomEvent = (data) =>{
    console.log("Custom event called from parent",data)
}

Parent Component:

fire that onCustomEvent() from parent

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Devesh Tiwari
  • 85
  • 1
  • 12

0 Answers0