Invoke a function from a component in another component

const compB: React.FC = () => {

const testFn = () =>{
alert(…)
}

function summary(){
console.log(Summary)
}

}

export default compB;

const compA: : React.FC = () => {

const test=() =>
{
compB.summary();
compB.testFn();
}

return(

)

}
export default compA

Wanted to achieve this, method call from compA to the compB functions. Any suggestion?

After a longer time, found something on the above. using the props will resolve the issue.
refer: gracious-leakey-v8kuyu - CodeSandbox