function Example() {
const [state, setState] = useState(0)
const someFunction= ()=>{
///some task that return a value
let value = getFunction()
setState(value)
console.log(state) //prints 0 ???
}
return ( <></> );
}
export default Example;
As you can see the state doesn't change. What can I do to solve this. I tried using useEffect too
I tried using useEffect but no luck