React · Senior · Question 3 of 75
How does the render phase differ from the commit phase?
- ✓Correct answer: Render is interruptible and can repeat; commit synchronously applies changes to the DOM
- 2Render changes the DOM directly, while commit only writes a change log to DevTools
- 3Both phases are synchronous and run exactly once per state update
Explanation
In the render phase, React calls components and computes the diff - it can be interrupted, discarded and restarted, which is why rendering must be pure. In the commit phase, changes are applied to the DOM all at once without interruption, then layout effects run, and after painting - regular effects.