Skip to main content

How React Works: The Complete Tutorial

A from-first-principles course that takes you from "I've used React" to "I understand how React actually works." No source-code spelunking, no file names, no magic, every concept is built up with plain-English explanations, complete runnable examples, step-by-step walkthroughs, and rendered diagrams.

Who this is for: frontend engineers who know JavaScript and have written React components, but have never learned what happens under the hood. What you need: ~1 hour of JavaScript prerequisites (chapter 0.1 covers exactly what) and curiosity. What's inside: 51 chapters across 9 parts · 100+ rendered diagrams.


The learning path

Part 0: Start here

#ChapterWhat it gives you
0.1JavaScript you actually needClosures, event loop, micro vs macrotasks, Object.is, immutability, the five things everything else stands on

Part 1: Foundations: the mental model

#ChapterWhat it gives you
1.1The problem React solvesWhy manual DOM syncing breaks; the declarative answer
1.2UI is a function of stateThe formula everything else follows from
1.3Elements are just objectsWhat JSX really creates, the keystone concept
1.4JSX under the hoodThe transform, the rules, the syntax traps
1.5Components and purityWhy render must be pure (this enables everything later)
1.6Render and commitThe two phases, the most important split in React

Part 2: The engine

#ChapterWhat it gives you
2.1The fiber treeReact's internal tree, where state actually lives
2.2Two trees: double bufferingCurrent vs draft tree; why renders are disposable
2.3Diffing, step by stepThe reconciliation rules and full traces
2.4Keys and identityWhat keys really do (identity, not performance)
2.5How the DOM gets updatedMinimal mutations, flags, the commit sequence

Part 3: State & hooks

#ChapterWhat it gives you
3.1What state really isMemory tied to tree position
3.2setState is a requestBatching, queues, the +1-not-+3 classic
3.3Hooks: the linked listThe one mechanism behind all hooks
3.4Rules of hooks, explainedWhy the rules exist, derived from the mechanism
3.5useState deep diveLazy init, Object.is bailout, mutation bugs
3.6useEffect deep diveSynchronization, not lifecycle; cleanups; races
3.7useLayoutEffect & timingThe paint timeline; when each effect fires
3.8useRef: the mutable boxThe sanctioned escape hatch
3.9useMemo & useCallbackReferential stability, the real reason they exist
3.10Context deep divePropagation mechanics; why it bypasses memo
3.11useReducer & advanced stateReducers, optimistic updates, state machines

Part 4: Concurrency: React's scheduler

#ChapterWhat it gives you
4.1The main thread problemWhy one thread doing everything is the constraint
4.2Time-slicingHow React yields every ~5ms to keep the page alive
4.3Priority lanesClicks > typing > transitions > hidden; preemption
4.4Concurrent renderingInterruptible, discardable renders
4.5TransitionsstartTransition, isPending, the no-downgrade rule
4.6useDeferredValueThe lagging-copy pattern for expensive UI
4.7External stores & tearingWhy useSyncExternalStore exists

Part 5: Suspense & errors

#ChapterWhat it gives you
5.1Suspense mental modelTry/catch for "not ready yet"
5.2Throwing promisesThe full mechanism, step by step
5.3Boundaries & retriesPlacement, granularity, waterfalls
5.4Suspense with transitionsWhy old screens stay visible
5.5Error boundariesThe error twin; what it can and can't catch

Part 6: React DOM

#ChapterWhat it gives you
6.1createRoot & the first renderWhat the entry point actually sets up
6.2Synthetic eventsRoot delegation, what onClick really is
6.3Controlled inputsThe enforcement loop nobody teaches
6.4PortalsDifferent DOM address, same React family

Part 7: Server rendering

#ChapterWhat it gives you
7.1SSR & hydrationHTML first, interactivity second
7.2Selective hydrationIslands, event replay, mismatches
7.3Server componentsComponents that never ship to the browser
7.4RSC streamingUI as streamed data; server actions
7.5Streaming SSRShell + progressive boundary swaps

Part 8: Performance

#ChapterWhat it gives you
8.1Wasted rendersMeasure first; the three structural fixes
8.2React.memoShallow compare, and the three ways it silently fails
8.3State structure patternsColocation, derived state, key resets, normalization
8.4The React CompilerAuto-memoization, what it does and how to think about it

Part 9: Advanced

#ChapterWhat it gives you
9.1StrictModeThe double-everything development X-ray
9.2Escape hatchesflushSync, imperative handles, act, last resorts
9.3Offscreen & ActivityHidden but alive: preserved trees
9.4The misconceptions master list24 myths, busted with proof

Part 10: Consolidation

#ChapterWhat it gives you
10.1GlossaryEvery term in the series, in plain English
10.2The mental model cheatsheetThe 12 laws + one master diagram
10.3Self-test40 questions to prove mastery

How the chapters work

Every chapter follows the same shape: What you'll learn → the concept built step by step with complete examples → diagrams (rendered images inline) → common misconceptionswhy it works this waytry it yourself experiments → recap → next chapter. New jargon always appears in a > **Jargon:** callout the moment it's introduced.