in parent functional component:
let [response, setresponse] = useState("undefined");
samplefunction = () => {
    setresponse("completed click");
}
in the child component:
<Button onClick={
    ()=> {
             props.samplefunction();
             console.log(props.response);
         }
}>Sample button</Button>
The problem is the props.response is giving value = completed click only after two clicks of the button.
upon single click, it is displaying the value = undefined which is deafult value from parent component