The meaning of life is to explore the world

React state pitfall

Posted on By Jason Liu

setState() may have delayed effect
This is because it is asynchronous method.
Reading this.state may get the wrong state.

Solution:
Try to use callback functions for setState().

my_image