transfer data from child to Parent Component

this is the child component inside pink border

Child data received in Parent:

  1. In child component send data inside transferFunction

    export default function Child({ transferFunction }) {
        transferFunction(DATA)
        return <div ></div>
      )
    }
  2. In parent get the data using callback function

    export default function Parent() { 
       return <div >
       <Child transferFunction={DATA=>ReceiveData(DATA)}/>
       </div>
    )
    }