Must knowReact Internals · 01

Start Here

The beginner entry point: reading order, a plain-English glossary and the top interview questions.

This section:trigger→schedule→render→commit→effects
On this page · 7 sections
  1. The whole thing in one paragraph
  2. Legend
  3. Reading order
  4. Plain-English glossary
  5. Commonly confused pairs
  6. Top interview questions
  7. Self-check

The beginner’s entry point to React Internals. The other notes in this folder are deep and checked against the React source code. This note explains the same ideas in plain English: what to read first, what each confusing word means, and which parts actually matter in an interview.

The whole thing in one paragraph

Think of a restaurant. A customer orders something (a click calls setState). The kitchen prepares the plate on the counter, where the customer can’t see it yet. The cook can stop halfway through to deal with a more urgent order, or throw the plate away and start again. This is the render phase. When the plate is ready, the waiter serves it in one go. The customer never gets half a plate. This is the commit phase. After serving, the staff do the follow-up chores: wiping the table, updating the bill. These are the effects.

🧾Ordernothing ordered
→
🍳Kitchen counterempty
→
🍽️Table (what the customer sees)yesterday’s plate
→
🧽Chores—
in React: –
  1. triggersetState(…)A customer orders. In React: an event handler calls setState. The order is written down; nothing is cooked yet.
  2. render phaserender phaseThe kitchen starts preparing the plate on the counter, where the customer can’t see it. In React: your components are called and the new tree is worked out.
  3. render phaseurgent order arrivesA more urgent order comes in. The cook can pause or throw the plate away and start again: nothing has been served. In React: transition renders can be interrupted and discarded.
  4. render phaserender finishedThe plate is ready on the counter. The customer still sees the old table.
  5. commit phasecommit phaseThe waiter serves the whole plate in one go. The customer never gets half a plate. In React: all DOM changes are applied synchronously, at once.
  6. browserbrowser paintsThe customer looks at the table and sees the food. In React: the browser paints.
  7. after paintuseEffectAfterwards the staff do the follow-up chores: wipe the table, update the bill. In React: useEffect runs.
current stepcomponent runningcreatedupdated / movedcompletedokwrong

0 / 0
The restaurant analogy, animated: order → kitchen → serve → chores is trigger → render → commit → effects.
1Trigger
  • root.render()
  • setState / dispatch
  • lane picked, update queued
2Render phase
pure · interruptible
  • call components (beginWork)
  • reconcile children (diff)
  • prepare DOM (completeWork)
3Commit phase
sync · atomic
  • before mutation
  • mutation: DOM writes
  • swap trees
  • layout: useLayoutEffect, refs
4Browser
  • style / layout
  • paint
5After paint
  • passive effects
  • useEffect
Every update goes through the same five steps. Only the render phase can pause.

In real terms: your components return elements → React compares them with what it rendered last time (reconciliation) → it records that work on a tree of objects called fibers, using a loop it can pause → it applies all the DOM changes at once (commit) → the browser paints → useEffect runs. Every other topic in this folder is a detail of one step in that sentence.

Legend

Label Meaning
Must know Gets asked often. You should be able to explain it out loud without notes.
Good to know Rarely asked directly, but mentioning it turns an OK answer into a strong one.
Skip for interviews An implementation detail (function names, bit tricks, timing constants) or vague high-level talk. Interesting, but it won’t help you answer anything. Each one says why it’s skippable.

Reading order

Read these in order. Each note builds on the ones before it.

  1. Render and Commit: the big picture. Read the whole note.
    • Read for: what “rendering” really means, the phases, why render must be pure, what the “virtual DOM” actually is.
  2. Reconciliation: how React decides what changed. Read the whole note.
    • Read for: the type rule, keys, why state is tied to position, why you never define components inside components.
  3. React Fiber: the data structure everything runs on.
    • Read: the Interview Q&A, “The problem”, “The tree is a linked list”, “Double buffering”.
    • Skim: “What a fiber holds” (the constructor field by field). You only need to know that a fiber stores type, props, state, and links to parent/child/sibling.
  4. Hooks Under the Hood: where state lives and why the Rules of Hooks exist.
    • Read: the Interview Q&A, “The hook list”, “Why conditional hooks break, concretely”, “setState: from call to render”.
    • “Processing the queue during render” and rebasing: read once, don’t memorize.
  5. Commit Phase and Effects: when the DOM changes and when effects run.
    • Effect ordering (child before parent, cleanups before setups), and useLayoutEffect vs useEffect.
    • The names of the sub-phases (before mutation → mutation → layout).
  6. The Work Loop: how React walks the tree.
    • The “Bailouts” section: why a child re-renders when its parent does, and how memo and children stop that.
    • The beginWork/completeWork code paths: these are function names, not concepts.
  7. Scheduler, Lanes and Batching: priorities and batching.
    • Batching (multiple setState calls → one render).
    • Lanes as priorities, and the fact that only transitions are interruptible.
    • The min-heap, the 5ms slices, MessageChannel, starvation timeouts: scheduler engineering trivia.
  8. Child Reconciliation Algorithm: how lists are diffed.
    • Why index keys break things (the Interview Q&A covers it).
    • The lastPlacedIndex walkthroughs and the Vue LIS comparison: only useful if you’re asked to implement a diff.
  9. A State Update, End to End: one click traced through React. Read this last, as a review that ties everything together. Don’t memorize the ~30 function names (); follow the story.

If you only have one evening: read notes 1, 2, 4 and 5, plus the Bailouts section of note 6, then the Top interview questions below.

Plain-English glossary

Each term has a short explanation, a label, and a link to the note that goes deeper.

The pipeline (Render and Commit)

Reconciliation (Reconciliation)

Fiber (React Fiber)

The work loop (The Work Loop)

Commit and effects (Commit Phase and Effects)

Scheduling (Scheduler, Lanes and Batching)

Hooks (Hooks Under the Hood)

List diffing (Child Reconciliation Algorithm)

Commonly confused pairs

Pair The difference in one line
Element vs fiber vs DOM node Element = a throwaway description (new every render). Fiber = React’s long-lived record of the instance. DOM node = the real thing on the page.
Render vs commit vs paint Render = call components (no DOM). Commit = apply DOM changes. Paint = the browser draws the pixels.
Rendering vs reconciliation Rendering is calling your component. Reconciliation is comparing its output with last time. Both happen in the render phase.
useLayoutEffect vs useEffect Layout effect: before paint, blocks it. Effect: after paint, doesn’t block.
current vs workInProgress On screen vs the draft being built. Commit swaps them.
Batching vs time slicing Batching = many updates → one render. Time slicing = one render split into small chunks. They’re unrelated.
Re-render vs remount Re-render = function runs again, state kept. Remount = destroyed and recreated, state lost.
Sync vs concurrent rendering Sync = can’t be interrupted (default for clicks/typing). Concurrent = interruptible (transitions, deferred values).

Top interview questions

Short answers you can say out loud. Each one links to the note that goes deeper.

What happens when you call setState?

React queues an update on that component’s fiber, gives it a priority, and schedules a render. It doesn’t render immediately, so several updates get batched. During render it recalculates the state, compares the output, and in the commit it applies only what changed to the DOM. → A State Update, End to End

What is reconciliation?

Comparing the new elements with the previous tree to decide what to keep, update, create or delete. It’s O(n) because of two rules: a different type means a new subtree, and keys identify list items. → Reconciliation

What is React Fiber and why was it introduced?

It’s React’s engine since v16. Each component instance is a fiber object, linked into a tree that a loop processes one unit at a time. Unlike the old recursive engine, it can pause, prioritize and discard work, which is what makes concurrent features possible. → React Fiber

What are the render and commit phases?

Render: React calls your components and works out what changed. It’s pure and can be interrupted. Commit: React applies the changes to the DOM synchronously, then runs layout effects. The browser paints, then useEffect runs. → Render and Commit

Is the virtual DOM compared with the real DOM?

No. React compares new elements with its previous fiber tree, which it keeps in memory. It never reads the DOM to find differences. → Render and Commit

Why do keys matter, and why are index keys bad?

Keys let React match items across renders even when they move. With index keys, inserting or reordering makes React reuse the wrong item’s state and DOM node. → Child Reconciliation Algorithm

Why can't you call hooks conditionally?

Hooks are stored in a list on the fiber and matched by call order. Skipping one shifts every later hook onto the wrong data. → Hooks Under the Hood

Why does setCount(count + 1) three times only add one?

All three calls use the same count from that render. Use the updater form, setCount(c => c + 1), to chain them. → Hooks Under the Hood

useEffect vs useLayoutEffect?

Layout effects run after the DOM update but before paint, which is good for measuring and avoiding flicker. Regular effects run after paint and don’t block it. → Commit Phase and Effects

Why does a child re-render when the parent re-renders?

The parent creates a new props object every render, and React compares props by reference. Use memo, or pass the child in as children so the element is created higher up. → The Work Loop

What is automatic batching?

Several state updates in the same event or tick produce one render. Since React 18 this also works in promises, timeouts and native listeners. → Scheduler, Lanes and Batching

Why must components be pure?

React may call them multiple times or throw a render away (Strict Mode, interrupted transitions). Side effects in render would run an unpredictable number of times. → Render and Commit

Does React 18+ always render concurrently?

No. Normal updates render synchronously. Only transitions and deferred values use the interruptible mode. → Scheduler, Lanes and Batching

How does startTransition keep typing responsive?

It marks the update as low priority. React renders it in small chunks, yields to the browser between them, and abandons it if an urgent update (a keystroke) arrives. → Scheduler, Lanes and Batching

Why does changing a key reset a component's state?

State is tied to type, position and key. A new key means React treats it as a different component: it unmounts the old one and mounts a fresh one. → Reconciliation

What's double buffering in React?

React builds the next tree as a draft (workInProgress) next to the visible one (current), and the commit swaps a pointer. The user never sees a half-built tree. → React Fiber

Self-check

Try to explain each of these out loud, without looking. If you get stuck, reread the linked note.