<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Neha Malvia</title>
    <description>The latest articles on DEV Community by Neha Malvia (@nehamalviaaa).</description>
    <link>https://dev.to/nehamalviaaa</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1613352%2Fa5a9978d-7dc0-41f8-b6bb-842f0dd7ec38.jpeg</url>
      <title>DEV Community: Neha Malvia</title>
      <link>https://dev.to/nehamalviaaa</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nehamalviaaa"/>
    <language>en</language>
    <item>
      <title>Part 3 - Concurrent Rendering &amp; Lanes (React 18)</title>
      <dc:creator>Neha Malvia</dc:creator>
      <pubDate>Tue, 17 Mar 2026 12:57:19 +0000</pubDate>
      <link>https://dev.to/nehamalviaaa/part-3-concurrent-rendering-lanes-react-18-2n0e</link>
      <guid>https://dev.to/nehamalviaaa/part-3-concurrent-rendering-lanes-react-18-2n0e</guid>
      <description>&lt;p&gt;In the previous parts, we saw how Fiber (React 16) broke the rendering work into small chunks. It gave React the ability to pause, but the engine was still "Sequential." It worked on one task at a time, just with better interruptions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;React 18&lt;/strong&gt; changes the fundamental nature of time in React. It moves us from a "Sequential" world to a "Concurrent" one.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;1. The React 16 Foundation: Fiber Root &amp;amp; Pausable Work&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In React 16, we introduced the &lt;strong&gt;Fiber architecture&lt;/strong&gt;. This gave us the "Work-in-Progress" tree and "Current" tree.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The Mechanism:&lt;/strong&gt; React could pause the "Render" phase to let the browser paint a frame, then resume.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Limit:&lt;/strong&gt; Updates were prioritized using a simple countdown called &lt;strong&gt;Expiration Times&lt;/strong&gt;. It was a linear queue where one update had to "win" over another.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;strong&gt;2. The React 18 Solution: Concurrency &amp;amp; the "Lanes" Model&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;React 18 replaces "Expiration Times" with a &lt;strong&gt;Lanes Model&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How the Lanes Model Works:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Instead of a single timestamp for when an update expires, React now performs &lt;strong&gt;bitmask operations&lt;/strong&gt; to group and filter work. Each "lane" represents a category of priority using a 32-bit integer.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Bitwise Priority:&lt;/strong&gt; React assigns a specific bit to each type of task. For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Sync Lane:&lt;/strong&gt; &lt;code&gt;0b0000000000000000000000000000001&lt;/code&gt; (Immediate updates like typing).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;InputContinuous Lane:&lt;/strong&gt; Used for things like scrolling or zooming.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Default/Transition Lane:&lt;/strong&gt; For data fetching or heavy list rendering.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Multitasking &amp;amp; Interleaving:&lt;/strong&gt; Because these are bits, React can combine multiple lanes into a single "bundle" of work (e.g., handling three different transitions at once). If React is working on a "Transition Lane" and a user types in a search box, a "Sync Lane" bit is flipped. React sees this bit has a higher mathematical priority, &lt;strong&gt;pauses&lt;/strong&gt; the transition work immediately, handles the keystroke, and then returns to the transition work.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;The Highway Analogy:&lt;/strong&gt; Think of the Lanes Model as a &lt;strong&gt;32-lane highway&lt;/strong&gt;. Different types of updates travel in their own dedicated lanes. Urgent updates (like typing) get priority lanes and can quickly "bypass" slower traffic (like background data fetching) in adjacent lanes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Entanglement:&lt;/strong&gt; If two updates depend on each other, React can "entangle" their lanes, forcing them to finish together so the UI doesn't look inconsistent.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;&lt;strong&gt;3. Key Features Enabled by Concurrency&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Automatic Batching&lt;/strong&gt;&lt;br&gt;
Previously, React only batched updates inside event handlers. React 18 now batches &lt;em&gt;everything&lt;/em&gt;—even inside &lt;code&gt;fetch()&lt;/code&gt;, &lt;code&gt;setTimeout()&lt;/code&gt;, or native events. This cuts down on unnecessary re-renders by grouping multiple state changes into one single render pass.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Transitions (&lt;code&gt;useTransition&lt;/code&gt;)&lt;/strong&gt;&lt;br&gt;
This is the most "human" part of the update. You can now explicitly tell React: &lt;em&gt;"This update is not urgent."&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;While the transition is rendering in the background, the UI remains interactive.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Benefit:&lt;/strong&gt; No more "janky" inputs while a heavy list is filtering.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Selective Hydration: Smarter Server-Side Rendering&lt;/strong&gt;&lt;br&gt;
React 18 also fixed the "All-or-Nothing" problem of SSR.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The Old Way:&lt;/strong&gt; You had to download and hydrate the &lt;em&gt;entire&lt;/em&gt; page before you could click a single button.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The New Way:&lt;/strong&gt; Using &lt;code&gt;&amp;lt;Suspense&amp;gt;&lt;/code&gt;, React can now &lt;strong&gt;stream&lt;/strong&gt; HTML and &lt;strong&gt;selectively hydrate&lt;/strong&gt; components.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Benefit:&lt;/strong&gt; If a user clicks a component that hasn't hydrated yet, React will "jump the lane" and hydrate that specific component first.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;strong&gt;4. Why it is Beneficial&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Decoupled Rendering:&lt;/strong&gt; You can start a heavy render in the background without freezing the input field.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Predictive UI:&lt;/strong&gt; React can "prepare" a screen in a hidden lane while the user is still looking at the old screen, switching only when the new one is ready (this is the core of &lt;code&gt;Suspense&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No More "Jank":&lt;/strong&gt; By splitting work into these 32 lanes, React ensures that high-frequency events (like mouse moves) always have a free lane to bypass slow computations.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;Comparison: Expiration Times vs. Lanes&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;Expiration Times (React 16)&lt;/th&gt;
&lt;th&gt;Lanes Model (React 18)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Logic Type&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Linear / Queue-based&lt;/td&gt;
&lt;td&gt;Bitwise / Category-based&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Multitasking&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Sequential: One update at a time&lt;/td&gt;
&lt;td&gt;Concurrent: Multiple updates can overlap&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Priority Handling&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Based on "age" (how long it's waited)&lt;/td&gt;
&lt;td&gt;Based on "type" (User Input vs. Background)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Interruption&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Limited: Hard to resume partially done work&lt;/td&gt;
&lt;td&gt;Advanced: Can pause, branch, and resume work&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Relationship&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Updates are independent&lt;/td&gt;
&lt;td&gt;Updates can be "entangled" together&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;p&gt;&lt;strong&gt;Conclusion: Mastering the Dimension of Time&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;React 18 didn't just make the engine faster; it made it &lt;strong&gt;smart&lt;/strong&gt;. By moving from a simple "pausable" queue to a &lt;strong&gt;32-lane Concurrent system&lt;/strong&gt;, React evolved from a basic UI library into a sophisticated scheduler.&lt;/p&gt;

&lt;p&gt;By mastering &lt;strong&gt;Bitmasks&lt;/strong&gt; and &lt;strong&gt;Lanes&lt;/strong&gt;, you’ve moved beyond basic state management. You now understand how React manages the most precious resource in the browser: &lt;strong&gt;Main Thread Time&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;However, even with a smart engine, we still spend hours manually tweaking performance with &lt;code&gt;useMemo&lt;/code&gt; and &lt;code&gt;useCallback&lt;/code&gt;. In the final part of this series, we’ll look at the &lt;strong&gt;React 19 Compiler&lt;/strong&gt;—the evolution that turns React from a library you have to optimize into one that finally optimizes itself.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;📚 Deep Dive References&lt;/strong&gt;&lt;br&gt;
If you want to see the original "blueprints" for Concurrent React, these are the essential reads:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;React 18 Official Release Post:&lt;/strong&gt; The high-level overview of the Concurrency shift. 
&lt;a href="https://react.dev/blog/2022/03/29/react-v18" rel="noopener noreferrer"&gt;React v18.0 Release&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Lanes Model (Original PR):&lt;/strong&gt; The actual bitwise logic that replaced Expiration Times.
&lt;a href="https://github.com/facebook/react/pull/18796" rel="noopener noreferrer"&gt;React PR #18796 - Initial Lanes Implementation&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;New Suspense Architecture:&lt;/strong&gt; Deep dive into Selective Hydration and Streaming SSR.
&lt;a href="https://github.com/reactwg/react-18/discussions/37" rel="noopener noreferrer"&gt;React WG - Selective Hydration Deep Dive&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Transition API:&lt;/strong&gt; How to talk to the Lanes model directly from your code.
&lt;a href="https://react.dev/reference/react/useTransition" rel="noopener noreferrer"&gt;react.dev - useTransition Reference&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>frontend</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Part 2 - The Fiber Revolution (React 16)</title>
      <dc:creator>Neha Malvia</dc:creator>
      <pubDate>Sun, 25 Jan 2026 07:38:40 +0000</pubDate>
      <link>https://dev.to/nehamalviaaa/part-2-the-fiber-revolution-react-16-3g54</link>
      <guid>https://dev.to/nehamalviaaa/part-2-the-fiber-revolution-react-16-3g54</guid>
      <description>&lt;p&gt;In React 15, we hit a wall: the "Stack" was too rigid. We realized we needed to decouple &lt;strong&gt;Diffing&lt;/strong&gt; (calculating changes) from &lt;strong&gt;Patching&lt;/strong&gt; (writing to the DOM). More importantly, we needed the ability to pause execution for high-priority tasks like user input.&lt;/p&gt;

&lt;p&gt;React 16 introduced &lt;strong&gt;Fiber&lt;/strong&gt;—a complete rewrite of the core reconciliation engine. Fiber allows React to pause, resume, and prioritize work, giving "wings" to the user experience.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;1. The Foundation: What is a "Fiber"?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To understand Fiber, we must first distinguish between a React Element and a Fiber Node.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;React Element&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;These are plain JavaScript objects returned from &lt;code&gt;render()&lt;/code&gt;. They are &lt;strong&gt;immutable&lt;/strong&gt;. Every time a component renders, React throws away the old elements and creates new ones.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fiber Node&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A Fiber Node is a mutable internal object that represents the "real" state of your application. It acts as the unit of work. While elements are recreated, Fiber nodes are reused and persistent. They represent the actual UI components on the screen.&lt;/p&gt;

&lt;p&gt;If you looked inside a Fiber node, you would see these key technical fields:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;stateNode&lt;/code&gt;: The actual DOM element or class instance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;type&lt;/code&gt;: The function or class associated with the fiber.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;pendingProps&lt;/code&gt; &lt;strong&gt;vs&lt;/strong&gt; &lt;code&gt;memoizedProps&lt;/code&gt;: "New data" coming in vs "Current data" already rendered.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;updateQueue&lt;/code&gt;: A linked list of state changes waiting to be processed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;effectTag&lt;/code&gt;: A bitmask (e.g., 0b001) that tracks what needs to be done (Placement, Update, etc.).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;The Linked List Structure&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Fiber replaced the old recursive tree with a &lt;strong&gt;Singly Linked List&lt;/strong&gt;. Each Fiber node has three critical pointers that allow React to traverse the tree without using the JavaScript Call Stack:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Child:&lt;/strong&gt; Points to the first child.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sibling:&lt;/strong&gt; Points to the next sibling.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Return:&lt;/strong&gt; Points back to the parent.&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;&lt;strong&gt;2. The Internal Engine: The Work Loop&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;Work Loop&lt;/strong&gt; is the heart of React 16. It manages how much time is spent on reconciliation using &lt;strong&gt;Cooperative Scheduling&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;shouldYield()&lt;/code&gt;: The loop constantly asks the browser: "Do you have urgent work for me?" (via &lt;code&gt;requestIdleCallback&lt;/code&gt;). If the browser needs to paint a frame, React pauses.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Expiration Times&lt;/strong&gt;: React 16 used Expiration Times to prioritize updates. A user typing gets an earlier expiration (High Priority) than a data fetch (Low Priority).&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;strong&gt;3. The Two-Phase Reconciliation Process&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;React 16 fundamentally splits rendering into two distinct phases. This is the "secret sauce" that allows for interruptible rendering.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwfm8l7ngmtm1lmfozw9q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwfm8l7ngmtm1lmfozw9q.png" alt="Fiber architecture flow" width="748" height="471"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Phase 1: The Render Phase (Interruptible)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This phase is &lt;strong&gt;asynchronous&lt;/strong&gt;. React traverses the existing Fiber tree (the "Current" tree) and calculates exactly what needs to change. During this traversal, React is doing two massive things: &lt;strong&gt;Creating the WIP Tree&lt;/strong&gt; and &lt;strong&gt;Building the Effect List&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. The Trigger: State Update&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When &lt;code&gt;setState&lt;/code&gt; is called, React creates an &lt;strong&gt;Update Object&lt;/strong&gt;, places it in the &lt;code&gt;updateQueue&lt;/code&gt; of that Fiber, and signals the scheduler. React then starts at the HostRoot and begins creating a &lt;strong&gt;Work-In-Progress (WIP) Tree&lt;/strong&gt;. This WIP tree is a "draft" version of the Fiber nodes that will eventually replace the Current tree.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. The unit of work:&lt;/strong&gt; &lt;code&gt;beginWork()&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;React moves down the tree calling &lt;code&gt;beginWork()&lt;/code&gt; for each fiber node.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Cloning:&lt;/strong&gt; React clones the Fiber from the "Current" tree into the "WIP" tree.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Bailout:&lt;/strong&gt; If &lt;code&gt;pendingProps&lt;/code&gt; equals &lt;code&gt;memoizedProps&lt;/code&gt; and there's no update in the queue, React "bails out" and skips that subtree, simply reusing the old nodes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Diffing &amp;amp; Effect Tags:&lt;/strong&gt; If changes are found, React calculates the difference and marks the WIP Fiber with an Effect Tag using a bitmask (e.g., &lt;code&gt;Placement&lt;/code&gt;, &lt;code&gt;Update&lt;/code&gt;).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. Prioritization &amp;amp; Interruption&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Because React is working on a WIP Tree in the background, it can afford to be interrupted. If a high-priority event (like a keystroke) arrives, React pauses the creation of the WIP tree.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;If the high-priority work doesn't affect the data React was just calculating, it resumes the WIP tree.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If it does change the same data, React discards the half-finished WIP tree and starts fresh.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4. The Backtrack &amp;amp; The Effect List:&lt;/strong&gt; &lt;code&gt;completeWork()&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Once React reaches a leaf node (no more children), it starts moving back up the tree via &lt;code&gt;completeWork()&lt;/code&gt;. This is where the Effect List is born.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Physical Preparation:&lt;/strong&gt; React prepares the DOM nodes for the WIP fiber (but does not touch the screen yet).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;The "Christmas Lights" (Effect List):&lt;/strong&gt; As React backtracks, it collects all the Fibers that have Effect Tags and links them together into a linear linked list.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;The Benefit:&lt;/strong&gt; By the time React reaches the Root, it has a separate, tiny list of "dirty" nodes. It doesn't need to look at the whole tree anymore; it just needs to follow this list.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;strong&gt;Phase 2: The Commit Phase (Synchronous)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now that the "Math" is done and the WIP Tree is ready, React enters the Commit Phase. This is &lt;strong&gt;synchronous and uninterruptible&lt;/strong&gt; to prevent visual glitches.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. DOM Updates &amp;amp; The Swap&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;DOM Update:&lt;/strong&gt; React follows the Effects List (the shortcut) to jump directly to nodes that need changing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Double Buffering (The Swap):&lt;/strong&gt; React maintains two trees: Current (on screen) and WIP (the draft). Once the DOM is patched, React performs a "Pointer Swap":&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;FiberRoot.current = WorkInProgressTree&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Instantly, the "Draft" becomes the new reality.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Post-Update Lifecycles&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;React runs side effects: &lt;code&gt;componentDidMount&lt;/code&gt;, &lt;code&gt;componentDidUpdate&lt;/code&gt;, and updates &lt;code&gt;refs&lt;/code&gt;. The main thread is then released back to the browser.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Conclusion: From Blocking to Cooperative&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;React 16 didn't just add features; it gave React a brain. By moving from a rigid "Stack" to a flexible "Linked List" of Fibers, React stopped being a blocking force and became a cooperative citizen of the browser.&lt;/p&gt;

&lt;p&gt;The secret was making the update process Asynchronous. Instead of finishing the whole UI in one go, React learned to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Break work into tiny chunks (Fiber nodes).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Pause if the browser had something more important to do.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Draft the new UI in the background (WIP Tree) without touching the screen.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Commit everything in one lightning-fast, synchronous burst.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;By understanding &lt;code&gt;beginWork&lt;/code&gt;, &lt;code&gt;completeWork&lt;/code&gt;, and &lt;code&gt;effectTag&lt;/code&gt; bitmasks, you’ve mastered the mechanics of the Fiber engine. But while React 16 gave us the engine, it didn't yet have the smart "traffic control" system to handle multiple updates at once.&lt;/p&gt;

&lt;p&gt;In the next part, we’ll see how React 18 took this Fiber engine and added "Lanes"—the traffic control system that finally unlocked the full power of Concurrent React.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;📚 Deep Dive References&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you want to look at the original documents that inspired this architecture, I highly recommend these:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;The Fiber Architecture (The Official Design Doc):&lt;/strong&gt; Written by Andrew Clark, this is the original blueprint that explained why React needed a rewrite.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Link: &lt;a href="https://github.com/acdlite/react-fiber-architecture" rel="noopener noreferrer"&gt;React Fiber Architecture on GitHub&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;Lin Clark’s "A Cartoon Guide to Fiber": This is the most famous explanation of the Fiber algorithm ever created. It’s perfect for visual learners.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Link: &lt;a href="https://www.youtube.com/watch?v=ZCuYPiUIONs" rel="noopener noreferrer"&gt;A Cartoon Guide to Fiber (React Conf 2017)&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;Inside Fiber: In-depth overview of the new reconciliation algorithm: A legendary technical blog by Max Koretskyi that dives into the source code of beginWork and completeWork.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Link: &lt;a href="https://blog.ag-grid.com/inside-fiber-an-in-depth-overview-of-the-new-reconciliation-algorithm-in-react/" rel="noopener noreferrer"&gt;Inside Fiber - Indepth Overview&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

</description>
      <category>architecture</category>
      <category>javascript</category>
      <category>performance</category>
      <category>react</category>
    </item>
    <item>
      <title>Part 1 — The Era of the Stack Reconciler</title>
      <dc:creator>Neha Malvia</dc:creator>
      <pubDate>Mon, 19 Jan 2026 17:35:49 +0000</pubDate>
      <link>https://dev.to/nehamalviaaa/part-1-the-era-of-the-stack-reconciler-4jg8</link>
      <guid>https://dev.to/nehamalviaaa/part-1-the-era-of-the-stack-reconciler-4jg8</guid>
      <description>&lt;p&gt;React 15 was defined by the &lt;strong&gt;Stack Reconciler&lt;/strong&gt;. During this era, the update process was &lt;strong&gt;synchronous and uninterruptible&lt;/strong&gt;. Once a state update started, React was like a high-speed train with no brakes; it couldn't pause, even if the tracks were blocked.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The High-Level Process&lt;/strong&gt;&lt;br&gt;
React maintains an in-memory tree (the Virtual DOM) that represents your component hierarchy. When an update occurs, React creates a new Virtual DOM, compares it with the previous version, and calculates the minimum number of changes needed to update the Real DOM.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Deep Diving into the Reconciliation Process&lt;/strong&gt;&lt;br&gt;
To understand why this architecture eventually hit a ceiling, we need to look at how it handled updates internally.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Filhvia4xpxly616649hq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Filhvia4xpxly616649hq.png" alt="React update flow diagram" width="800" height="396"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. The Trigger:&lt;/strong&gt; &lt;code&gt;this.setState()&lt;/code&gt;&lt;br&gt;
The moment a component calls &lt;code&gt;this.setState()&lt;/code&gt;, it’s a "go" signal. React immediately begins the process of figuring out what changed for that specific component and its entire subtree.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. The Recursive "Dive"&lt;/strong&gt;&lt;br&gt;
To understand the UI changes, React calls the &lt;code&gt;render()&lt;/code&gt; method. Because components are nested, this triggers a recursive chain:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If &lt;strong&gt;Component A&lt;/strong&gt; has a child &lt;strong&gt;Component B&lt;/strong&gt;, React calls &lt;code&gt;A.render()&lt;/code&gt;, then immediately dives down to call &lt;code&gt;B.render()&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Each of these function calls is pushed onto the &lt;strong&gt;JavaScript Call Stack&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;The Crucial Constraint:&lt;/strong&gt; JavaScript is single-threaded. If the Call Stack is occupied by React’s recursion, the browser cannot handle user inputs like scrolling or clicking a "Cancel" button. The main thread is "held hostage" until the stack is completely empty.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Generating the Virtual DOM&lt;/strong&gt;&lt;br&gt;
As the recursion moves down the tree, React produces a brand-new &lt;strong&gt;Virtual DOM&lt;/strong&gt;. This is a lightweight, in-memory JavaScript object representing the "desired" state of the UI at that exact moment.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Synchronous Diffing &amp;amp; Immediate DOM Patching&lt;/strong&gt;&lt;br&gt;
This is the most critical part of the React 15 architecture. In the Stack Reconciler, &lt;strong&gt;Diffing&lt;/strong&gt; (finding the difference) and &lt;strong&gt;Patching&lt;/strong&gt; (updating the screen) happened &lt;strong&gt;simultaneously&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;As the algorithm walked the tree and found a difference—for example, a &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; changing to a &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt;—it would immediately call &lt;code&gt;document.setAttribute&lt;/code&gt; or &lt;code&gt;appendChild&lt;/code&gt; to update the Real DOM right then and there.&lt;/p&gt;

&lt;p&gt;Because React was mutating the Real DOM while still calculating the rest of the tree, the process was impossible to pause. You couldn't stop halfway because you had already started changing what the user sees on their screen!&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;The Performance Bottleneck&lt;/strong&gt;&lt;br&gt;
Because these four steps happened in one unbroken chain of execution, the browser was effectively "locked" until the very last component in the tree was processed. If your component tree was large, this led to two major issues:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;"Jank" and Dropped Frames:&lt;/strong&gt; To maintain a smooth 60fps, a browser has about 16.6ms to paint a frame. If reconciliation took 30ms, the browser would skip a frame, leading to visible stuttering or "jank."&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Delayed User Interactions:&lt;/strong&gt; If a user typed into an input field while React was busy reconciling a large list, the keystroke wouldn't appear on the screen until the entire tree was finished.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;The Realization&lt;/strong&gt;&lt;br&gt;
React engineers realized that &lt;strong&gt;Simultaneous Diffing and Patching&lt;/strong&gt; was a dead end for complex, highly interactive applications. To move forward, they needed to achieve two things:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Decouple&lt;/strong&gt; the "Math" (Diffing) from the "Writing" (Patching).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Enable Pausing&lt;/strong&gt;: The ability to stop the "Math" if the user does something more important.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This realization set the stage for the most ambitious rewrite in React's history: &lt;strong&gt;Fiber&lt;/strong&gt;. In Part 2, we will dive deep into how Fiber completely re-engineered the internals of React to make the web feel more fluid than ever before.&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>frontend</category>
      <category>javascript</category>
      <category>react</category>
    </item>
  </channel>
</rss>
