Facing an issue in converting PromptComponent from class based to function based

This screenshot shows a function in the class based component
which is being accessed by other parent components with the help of useRef hook.
Example:-


This shows how the show function is tapped by the parent component and is called.

Now, since I have converted the promptComponent to function based, the “show” function is not available in Ref hook.
I tried using state hooks and useCallBack but unable to find a way to communicate from child component to parent component, i.e. the response “Yes” or “No” from promptComponent.
But it is not workin, kindly guide me over this…

I guess, I found a solution…
It is “forwardRef and useImperativeHandle”…
Coding it…