Command Palette

Search for a command to run...

Hectal
Back to the lesson: Topic 26.1 — React Internals: Fiber, Lanes and the Scheduler
React · Example 4 of 4 React 18+

Lanes: one click, two renders

Both updates come from the same click, but they land in different lanes. React renders and commits the sync lane first (slow is still 0 in that render), then renders the transition lane. The order in your code doesn't matter: priority does.

Inside React every component instance is a fiber, a plain object linked into a tree; a work loop renders fibers one unit at a time, lanes decide which updates go first, and a finished tree is swapped in during a commit that cannot be interrupted.

Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.

Ready for more? This phase has 6 hands-on exercises with automatic checks.

Practice questions

Write the code in the editor, run it, then open the model answer to compare.

01

Write a function countFibers(fiber) that walks a fiber subtree using only child, sibling and return (no recursion) and returns how many fibers it has.

02

Predict the console order for a component A with a useLayoutEffect and a useEffect, rendering a child B with the same two effects, on first mount.

Explain it without notes

01

What is a fiber and what does it store?

02

Walk through the render phase and the commit phase. Which one can be interrupted, and why does that matter for your code?

03

What is double buffering in React?

04

What are lanes, and how does React decide which update renders first?

05

How does the scheduler keep the page responsive during a big render?

Lanes: one click, two renders React 18+

Preview

Press Run to see the page.

Console

Nothing logged yet.

Expected console output

render: urgent = 0 slow = 0
--- click ---
render: urgent = 1 slow = 0
render: urgent = 1 slow = 1