As I have been browsing Stack Overflow questions, I’ve noticed that many bugs are due to trying to access a state value after setting it.
An example question on Stack Overflow.
I’ve stumbled many times for being unaware of
setState being an asynchronous operation.
How do we access the state value right after setting it then?