As covered in the docs:
and many posts here, a call to
.setState() is not guaranteed to immediately reflect via
For example if I call:
the result of
undefined, rather there is no guarantees of what the value will be)
This point is clear to me.
But I’m interested in why this decision was taken.
I understand the desire to batch renders for performance reasons, but this does not seem to explain why the effects of
.setState() cannot be synchronous; the two requirements are orthogonal to my understanding.
Please can someone point me towards some reading material?