React: Render vs Commit phase
23 October 2022 (Updated 18 June 2023)
On this page
In a nutshell
React splits its work into a “render phase” and a “commit phase”.
Render phase
Contains all the work of walking through your component tree and building the virtual DOM/element tree.
Commit phase
At this point, React has figured out what changes need to be applied to the DOM. So it applies the necessary changes to match the DOM tree with the new virtual DOM. Layout effects and class component lifecycle hooks are executed here.
The useEffect
hooks run on a short delay after the commit phase is done, to allow the browser to paint before the effects are run.
Sources
Tagged:
React
Thanks for your comment 🙏. Once it's approved, it will appear here.
Leave a comment