Skip to content

Foundations & Mental Model

React renders your UI as a function of state: UI = f(state). You don’t manually update the DOM when data changes — you describe what the UI should look like for the current state, and React figures out the minimal DOM changes to get there.

Every advanced topic — hooks, reconciliation, Suspense, the compiler — is a consequence of taking that one equation seriously. Get the model right and the rest follows.

LessonWhat you’ll learn
Why React & the modelDeclarative vs imperative, and UI = f(state)
JSX & elementsWhat JSX compiles to, and what an element really is
Rendering & reconciliationThe render/commit phases, the virtual tree, and keys
State snapshot & purityState as a snapshot, immutability, and why render is pure

Two ideas explain almost everything React does:

flowchart TB
  f["UI = f(state)
(you describe, React updates)"] --> render["Re-render on state change
(compute the new tree)"]
  pure["Render is pure
(no side effects, same input same output)"] --> render
  render --> recon["Reconciliation
(diff old vs new, patch the DOM)"]
The two ideas everything builds on
  • Because UI is a function of state, a change to state triggers a re-render — React re-runs your component to compute what the UI should now be.
  • Because render is pure, React is free to call it whenever, batch it, restart it, or run it twice (StrictMode) — which is exactly what makes concurrent features possible.

Hold those two and React stops surprising you.

What is the core equation React is built on?
In React, how do you update what the user sees?
Why does React require render to be pure?