Tengo tres componentes: ComponentA, ComponentB y Home (Home es el elemento principal del componente). Quiero llamar a una función contenida en ComponentA usando un botón que está dentro de ComponentB .
const ComponentA= () => { const hello=()=>{ console.log("hello"); } return <></> }) const ComponentB= () => { const callComponentAFunction=()=>{ // I need call "hello()" from ComponentA } return <> <button onClick={callComponentAFunction}>Call function from ComponentA</button> </> }) const Home= () => { return (<> <ComponentA> <ComponentB /> </ComponentA> </>) }) ¿Cómo puedo llamar a la función hello() (dentro de ComponentA ) desde ComponentB ?