3 ms·
if you need to await a setState call, you're prob structuring your logic in a less-than-efficient way. in whatever handler is calling setState, you should compu
by test098 3y ago
if you need to await a setState call, you're prob structuring your logic in a less-than-efficient way. in whatever handler is calling setState, you should compute the next state in the handler, setState(nextState), then use that nextState for whatever comes next.
- verelo 3y agoI don’t know, i agree it wasn’t in the react style but it was in the style of basic logic On change detect new file is there, Set file to variable, Call api to save state. The issue is setting the variable and calling save is now a race condition.