As explained in the previous section, React intentionally “waits” until all components call setState()
in their event handlers before starting to re-render. This boosts performance by avoiding unnecessary re-renders.
However, you might still be wondering why React doesn’t just update this.state
immediately without re-rendering.
There are two main reasons:
props
and state
, causing issues that are very hard to debug.This GitHub comment dives deep into the specific examples.
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.