In this blog I am going to share my personal analysis on React re-render workflow. In React re-rendering there are mainly 4 steps, let me tell you in very simple words what all 4 steps do:
Step 1. Trigger β basically it is when React triggers a render. There can be many ways to trigger, for example:
state change
props change
context change
parent re-render
Note : React does not immediately update DOM here, it just schedules an update.
Step 2. Render Phase β here Fiber engine comes into picture. It handles reconciliation of new changes.
Basically it:
creates new Virtual DOM
compares it with previous Virtual DOM (diffing)
decides what needs to update, delete, or create
Note : This phase is pure computation (no DOM updates)
It can be paused, restarted, or interrupted (Concurrent React)
React builds a work tree using Fiber nodes
Step 3. Commit Phase β after render phase, commit phase starts. This phase cannot be stopped.β¦