惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

The Cloudflare Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
T
The Blog of Author Tim Ferriss
G
Google Developers Blog
小众软件
小众软件
J
Java Code Geeks
V
Visual Studio Blog
The Register - Security
The Register - Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
罗磊的独立博客
美团技术团队
阮一峰的网络日志
阮一峰的网络日志
V
V2EX
博客园 - 叶小钗
N
Netflix TechBlog - Medium
月光博客
月光博客
aimingoo的专栏
aimingoo的专栏
大猫的无限游戏
大猫的无限游戏
T
The Exploit Database - CXSecurity.com
The Hacker News
The Hacker News
Cisco Talos Blog
Cisco Talos Blog
Hacker News: Ask HN
Hacker News: Ask HN
Hacker News - Newest:
Hacker News - Newest: "LLM"
AWS News Blog
AWS News Blog
Webroot Blog
Webroot Blog
The Last Watchdog
The Last Watchdog
T
Threatpost
I
Intezer
T
Tenable Blog
L
LINUX DO - 热门话题
T
Tailwind CSS Blog
Scott Helme
Scott Helme
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
C
Cybersecurity and Infrastructure Security Agency CISA
Engineering at Meta
Engineering at Meta
S
Schneier on Security
Recent Announcements
Recent Announcements
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
F
Fortinet All Blogs
腾讯CDC
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
T
Troy Hunt's Blog
量子位
H
Hacker News: Front Page
V2EX - 技术
V2EX - 技术
Google Online Security Blog
Google Online Security Blog
人人都是产品经理
人人都是产品经理
博客园 - 【当耐特】
博客园 - Franky
www.infosecurity-magazine.com
www.infosecurity-magazine.com

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
🚀 Day 2 of Learning React: Reconciliation, Diffing Algorithm, Render Phase, Commit Phase & React Fiber
Bismay.exe · 2026-06-24 · via DEV Community

📌 Missed Day 1? I covered why React exists, the Real DOM, Virtual DOM, and React Elements. You can read it here and then come back. I'll wait. ☕


Today was genuinely one of those sessions where you go in confused and come out feeling like you unlocked a new level.

Yesterday I learned what React does—it keeps a Virtual DOM in memory and updates only the parts of the Real DOM that actually changed.

Cool. Makes sense.

But one question kept bugging me all night:

How does React actually know what changed? 🤔

Today's class answered that question. And honestly? It completely changed how I think about React.

Let's get into it. 🚀


🧠 Quick Recap

Yesterday we answered one question:

Why was React created?

Here's what I took away from Day 1:

  • 🔧 Manually updating the DOM in large apps becomes unmanageable.
  • 💡 React introduced UI = Function(State)—we describe what we want, React handles the updates.
  • 📦 A React Element is just a plain JavaScript object that describes UI. It's not a real DOM node.
  • 🌳 The Virtual DOM is a lightweight copy of the UI that lives entirely in JavaScript memory.
  • ⚡ React compares changes in the Virtual DOM and updates only the necessary parts of the Real DOM.

Today we're answering a completely different question:

How does React actually update the UI?

That's where today's journey begins. 🔽


🔄 Reconciliation — How React Knows What Changed

This is the concept that finally tied everything together for me.

I kept thinking, "Okay, React compares two trees. But... how? And what does that even look like?"

Reconciliation is React's process for figuring out what changed between two renders.

Here's how I think about it. 🖊️

Imagine you're editing an essay. You've got the original version and a revised version side by side. Instead of rewriting the entire essay, you scan through both versions and find only the sentences that actually changed. Then you update just those.

That's essentially what React does—except it's comparing two Virtual DOM trees.

When something changes in your app (say, a button click updates some text), React doesn't throw away the entire UI and rebuild it from scratch. Instead, it:

  1. Creates a new Virtual DOM tree based on the updated state.
  2. Compares it with the previous Virtual DOM tree.
  3. Figures out the minimum set of changes needed.
  4. Applies only those changes to the Real DOM.

Here's a small example. Let's say our component renders this:

// Before state change
React.createElement("h1", {}, "Hello");

And after a state update, it renders this:

// After state change
React.createElement("h1", {}, "Hello React");

React compares these two trees and realizes: "The <h1> element is the same type, but the text inside changed from Hello to Hello React. I only need to update the text content."

That comparison process? That's reconciliation. 🔄

But here's the thing—reconciliation is just the strategy. The actual comparison happens through something more specific.


⚡ Diffing Algorithm — The Engine Behind Reconciliation

So how does React actually compare two Virtual DOM trees?

That's where the diffing algorithm comes in.

If reconciliation is the what ("figure out what changed"), diffing is the how ("here's how I compare the two trees").

Now, this part surprised me. 🤯

Comparing two trees might sound simple, but it's actually a hard computer science problem. A generic algorithm to compare two trees has a time complexity of O(n³)—which means for a tree with 1,000 elements, it could take a billion operations.

That's way too slow for a UI library.

I paused the video here. I was like, "Wait... React does this on every single update? How is it fast?"

That's when I learned about React's clever trade-off. Instead of finding the perfect difference between two trees, the React team made a few practical assumptions that are almost always true in real-world applications. That keeps comparisons incredibly fast.

They built their diffing algorithm on two key assumptions:

1. Different types? Different trees. 🔀

If React sees that a <div> changed to a <section>, it doesn't bother comparing their children. It destroys the old tree and builds a new one from scratch.

// Before
React.createElement("div", {}, 
  React.createElement("p", {}, "Hello")
);

// After
React.createElement("section", {}, 
  React.createElement("p", {}, "Hello")
);

Even though the <p> inside is identical, React tears down the entire <div> subtree and creates a new <section> subtree. Different type = different tree. No questions asked.

2. Same type? Compare what changed. 🔎

If the element type stays the same, React keeps the DOM node and only updates the attributes that actually changed.

// Before
React.createElement("h1", { className: "title" }, "Hello");

// After
React.createElement("h1", { className: "title active" }, "Hello");

Here, the <h1> is still an <h1>. React keeps the same DOM node and only updates the className. Much more efficient. ⚡

3. Keys help React identify list items 🔑

When rendering lists, React uses keys to track which items changed, moved, or were removed.

items.map(item => 
  React.createElement("li", { key: item.id }, item.name)
);

I'll cover keys in more depth later in this series, but for now, just know they exist to help the diffing algorithm identify list items efficiently.

💡 The biggest misconception I had

I honestly thought React compared the Virtual DOM against the Real DOM.

That's wrong. ❌

React compares the new Virtual DOM against the previous Virtual DOM. The Real DOM is never part of the comparison. It only gets involved later, when React applies the changes.

That distinction seems small, but once I understood it, the entire mental model just... clicked. 🧩

Thanks to these assumptions, React's diffing algorithm runs in O(n) time—one pass through the tree. That's what makes it fast enough for real-time UI updates.

So now React knows exactly what changed. But it hasn't touched the Real DOM yet.

What happens next? 🤔


🎬 Render Phase — Planning, Not Painting

This is where things got really interesting for me.

When I first heard "Render Phase," I assumed it meant React was drawing things on the screen.

Nope. Not even close. 😅

The Render Phase is a planning phase. React calls your components, builds the new Virtual DOM tree, and runs the diffing algorithm to figure out what needs to change. But it does not touch the Real DOM during this phase.

Think of it like an architect creating a blueprint. 📐 The architect plans every room, every wall, every window—but no construction has started yet. The Render Phase is React creating that blueprint.

Here's what happens step by step:

  1. Something triggers a re-render (state change, prop change, etc.)
  2. React calls your component function again.
  3. Your component returns new React Elements.
  4. React builds a new Virtual DOM tree from those elements.
  5. React diffs the new tree against the previous tree.
  6. React produces a list of changes that need to be applied.

Let me show a simple example:

function Counter() {
  const [count, setCount] = React.useState(0);

  return React.createElement(
    "div",
    {},
    React.createElement("p", {}, "Count: " + count),
    React.createElement(
      "button",
      { onClick: () => setCount(count + 1) },
      "Increment"
    )
  );
}

When you click "Increment," React enters the Render Phase:

  • It calls Counter() again with the new state (count = 1).
  • It gets back a new tree where the <p> now says "Count: 1" instead of "Count: 0".
  • It diffs this against the old tree.
  • It notes: "Only the text inside <p> changed."

At this point, the screen still shows "Count: 0". Nothing visible has changed yet. 👀

I tried wrapping my head around this by opening VS Code and console-logging inside a component. The function runs again on every re-render—but the screen doesn't update until later. That's the Render Phase in action.

That leads us to the next phase.


✅ Commit Phase — Where the Real DOM Actually Changes

The Commit Phase is where React actually applies the changes to the Real DOM.

If the Render Phase is the architect drawing blueprints, the Commit Phase is the construction crew showing up and doing the work. 🏗️

During this phase, React takes the list of changes it prepared during the Render Phase and makes the actual DOM updates:

  • Adding new DOM nodes
  • Removing old DOM nodes
  • Updating attributes, text content, or event listeners

For our counter example, the Commit Phase would:

  1. Find the <p> DOM node.
  2. Update its text content from "Count: 0" to "Count: 1".

That's it. One targeted update instead of rebuilding the entire page. ✨

Here's the key difference between the two phases:

🎬 Render Phase ✅ Commit Phase
What it does Plans changes Applies changes
Touches the DOM? ❌ No ✅ Yes
Can be paused? ✅ Yes ❌ No
Output List of changes Updated DOM

Notice that the Render Phase can be paused—I'll explain why that matters when we get to Fiber. 🧵

The Commit Phase is synchronous. Once React starts applying changes to the DOM, it finishes all of them in one go without interruption.

But even after the Commit Phase, we're not done. The DOM has been updated, but you still can't see anything different on screen. Something else needs to happen.


🎨 Browser Paint — From DOM to Pixels

Before today, I thought React drew everything on the screen.

Turns out... React never paints a single pixel.

The browser does.

React's job ends after updating the DOM. That was a surprisingly big realization for me.

After React updates the DOM in the Commit Phase, the browser takes over. Now it needs to turn those DOM changes into actual pixels on your screen.

This happens in three steps:

📐 Layout — The browser calculates the size and position of every element. If you changed the text inside a <p>, the browser recalculates how much space that paragraph needs, and whether anything around it shifts.

🎨 Paint — The browser fills in the pixels. It draws the text, backgrounds, borders, shadows—everything visual.

🧩 Composite — The browser combines different layers (if any) into the final image you see on screen. Think of it like stacking transparent sheets on top of each other.

The important thing I realized today is:

React updates the DOM. The browser paints the pixels. They're two separate steps. 💡

React can't directly draw on the screen. It can only modify the DOM. The browser's rendering engine handles the rest.

That's why React focuses so hard on making minimal DOM changes—because every change triggers the browser's layout, paint, and composite pipeline. Fewer changes = less work for the browser = smoother experience for the user. 🚀


🔁 The Complete React Update Cycle

Now let's put everything together.

This was the moment everything connected for me.

Until now, I had been learning these concepts individually. Reconciliation. Diffing. Render Phase. Commit Phase. Browser Paint. They all made sense on their own, but I couldn't see how they fit together.

Then I drew this out on paper during the class, and suddenly the entire system clicked. ✨

When something changes in a React app, here's the full journey:

  State Change
       ↓
  Render Phase  (React calls components, builds new Virtual DOM)
       ↓
  Reconciliation  (Compare new vs old Virtual DOM)
       ↓
  Diffing  (Find minimum changes)
       ↓
  Commit Phase  (Apply changes to Real DOM)
       ↓
  Browser Paint  (Layout → Paint → Composite)
       ↓
  Pixels on Screen ✨

Every single update—whether it's a button click, a form input, or data arriving from an API—follows this exact same cycle.

Seeing them as one continuous pipeline completely changed my mental model of React. It stopped feeling like magic and started making sense as a system.

But there's one more thing I learned today that tied everything together even further. 🧵


🧵 React Fiber — Why React Never Freezes Anymore

When I first heard "Fiber," I honestly thought, "Great... another React buzzword."

Turns out it's one of the most important architectural changes React has ever made. This section completely changed how I think about React's internals.

Before React 16 (released in 2017), React's rendering was synchronous. When React started rendering, it went through the entire component tree in one shot. It couldn't stop. It couldn't pause. It couldn't prioritize.

Imagine you're watching a movie and you can't pause it. 🎬 Not even to answer the door. Not even if your house is on fire. You have to watch the entire thing from start to finish before you can do anything else.

That was React before Fiber.

For small apps, this was fine. But for large applications with complex component trees, a single render could take a while. During that time, the browser was completely blocked—no scrolling, no typing, no animations. Everything froze until React finished. 🥶

I remember thinking, "Wait, React was like that? How did anyone build large apps with it?"

That's the problem React Fiber was built to solve.

Fiber is a complete rewrite of React's core algorithm, introduced in React 16. It didn't change what React does—it changed how React does it.

With Fiber, React can:

  • ⏸️ Pause rendering work and come back to it later.
  • 🎯 Prioritize different types of updates. A user typing in a text field is more urgent than a background data fetch.
  • ▶️ Resume work that was paused without starting over.
  • 🗑️ Abort work that's no longer needed.

Think of it like switching from watching a DVD (can't pause) to streaming on Netflix (pause, rewind, skip, switch to a different show, come back later). 📺

The key insight is that Fiber makes React's Render Phase interruptible. Remember how I said the Render Phase can be paused? That's because of Fiber. 💡

The Commit Phase is still synchronous—once React starts applying changes to the DOM, it finishes without interruption. But the planning phase (Render Phase) can now be broken into chunks and spread across multiple frames, keeping the browser responsive.

This is why modern React apps feel snappy even when dealing with complex updates. Fiber ensures that React never hogs the main thread for too long. ⚡


⚖️ Virtual DOM vs Fiber — They're Not the Same Thing

This was confusing for me at first. I kept thinking: "Wait, did Fiber replace the Virtual DOM? Are they the same thing?"

Nope. They're different concepts that work together. 🤝

🌳 Virtual DOM 🧵 React Fiber
What it is A JavaScript representation of the UI React's reconciliation engine
Purpose Describes what the UI should look like Manages how and when updates happen
Introduced React's original design React 16 (2017)
Handles UI structure (the "what") Scheduling & prioritization (the "how")

Here's how they work together:

The Virtual DOM is still the concept—React keeps a lightweight JavaScript copy of your UI in memory and compares it to find changes. 🌳

Fiber is the engine that performs that comparison. It's the system that walks through the Virtual DOM tree, does the diffing, and decides when and how to apply updates to the Real DOM. 🧵

So the Virtual DOM is the data structure and Fiber is the algorithm that operates on it.

They're not competing concepts. Fiber is the reason the Virtual DOM approach works efficiently at scale. ⚖️


💡 My Biggest Takeaways Today

  • 🔄 Reconciliation is React's strategy—compare two Virtual DOM trees and find the minimum changes.
  • ⚡ The diffing algorithm runs in O(n) time because of two smart assumptions about how UIs typically change.
  • 🎬 The Render Phase is just planning. No DOM changes happen here.
  • ✅ The Commit Phase is where React actually updates the Real DOM.
  • 🧵 Fiber makes the Render Phase interruptible, so React never freezes the browser.

📚 Learning Source

I'm currently learning React through the React Cohort 3.0 by Devendra Dhote at Sheriyans Coding School.

This article isn't a copy of the course.

It's my personal understanding after today's class, rewritten entirely in my own words.

Writing these articles helps me reinforce what I've learned, and hopefully helps other beginners who are on the same journey. 🤝

If I've misunderstood something, I'd genuinely appreciate your corrections in the comments. 😊


🙌 Final Thoughts

Day 2 gave me a much deeper appreciation for what's happening behind the scenes in React.

Yesterday I understood the what. Today I understood the how. And honestly, that shift in understanding makes me way more excited to keep going. 🔥

Tomorrow I'm moving to Day 3, where I'll finally start getting hands-on:

  • ✏️ JSX
  • ⚡ Vite
  • 📁 Project Structure
  • 🧩 Fragments
  • 🔒 Strict Mode

I've been dying to write actual React code instead of just learning theory. Day 3 is where it gets real. 💻

See you there! 🚀


💬 When you first learned about React's update cycle, what was the hardest part to wrap your head around—Reconciliation, Fiber, or something else entirely?

I'd love to hear your experience in the comments. 😊

If you're following along with this series, you can also find me on GitHub, where I'll be sharing my projects and documenting my progress.

Thanks for reading! 🚀