Ashwini Handore’s Post

REACT INTERNALS - PART 12 Render Phase vs Commit Phase In earlier parts, we understood what rendering means. Now let’s go one level deeper: How does React actually update the UI internally? 🧠 The Core Idea React updates the UI in two phases: Render Phase → Prepare changes Commit Phase → Apply changes 🔄 1. Render Phase (Preparation) This is where React figures out what needs to change • Creates and updates the Fiber tree (each component is tracked) • Determines what needs to change in the UI • Prepares the next UI state No DOM updates happen here ❌ ⚠️ Key Behavior • Can be paused • Can be resumed • Can be interrupted This keeps the UI responsive ⚙️ 2. Commit Phase (Execution) This is where React applies the prepared changes • Applies all changes • Updates the DOM in one step • UI updates on screen ✔ ⚠️ Key Behavior • Cannot be paused • Cannot be interrupted Must complete fully to keep UI consistent 🧩 Simple Flow Render Phase (prepare) ↓ Commit Phase (apply) ↓ UI updates instantly 🎯 Why This Matters • Rendering work can pause → better responsiveness • Updates happen together → consistent UI • Overall smoother user experience 🔗 Connection to the Series • Re-renders → trigger updates • Batching → groups updates • Scheduling → prioritizes updates • Fiber → manages work in small units • This part → when work is prepared vs applied 🎯 Key Insight React prepares all changes first Then applies them together in one step 🔑 Final Takeaway Render phase is interruptible Commit phase is not 🎬 Wrapping Up the Series This completes our journey into how React works internally - from re-renders to Fiber and scheduling Next: Breaking down React Hooks in the same simple way #ReactJS #FrontendDevelopment #JavaScript #ReactInternals #SoftwareEngineering

  • diagram, text

To view or add a comment, sign in

Explore content categories