I have var in my state
const [currentNodef, setCurrentNodef] = React.useState();
and the function that is called by the button
const openModalUpdateNode= (rowInfo)=>{
const { node, treeIndex, path } = rowInfo;
setCurrentNodef(node);
console.log(currentNodef)
}
On the first click I get an undefined, on the second click the previous value.
As far as I understand, I need to wait for the state to be updated before reading it, but experimenting with async/await didn't bring the desired result.
Tell me, what could be the matter?