4 ms·
This is not true at all. `setName` queues up a state change for the next render cycle, and has no effect on the current render. You cannot actually edit state d
by phailhaus 2y ago
This is not true at all. `setName` queues up a state change for the next render cycle, and has no effect on the current render. You cannot actually edit state directly, so that multiple handlers will all read the same state value regardless of state changes queued up for the next render.
const [state, setState] = useState(0)
const func = () => {
console.log(state) // 0
setState(40)
console.log(state) // 0
}