Skip to content
FrontDepth, Home

Mini React

MiddleSenior

Build a small React from scratch: elements, reconciliation with keys, function components, useState, batching and useEffect.

What you will build

You will write a small React-like library in plain JavaScript, one idea per step. createElement builds element objects. render turns them into DOM nodes and later changes only what differs, and keys keep moved items attached to their nodes. Function components get state with useState, updates are batched in a , and useEffect runs side effects after the DOM is updated. In the last step a todo app written in JSX runs on your own library.

Every step ends with a note on how React 19 does the same job (fibers, lanes, the commit phase, event delegation), checked against React's source code and react.dev.

What you will learn

  • Explain what JSX compiles to and what a React element is
  • Reconcile old and new elements by type and key and change only what differs in the DOM
  • Implement hooks that keep state on a component instance in call order
  • Batch state updates in a microtask and run effects and cleanups in the right order
  • Connect each part of your library to the real mechanism in React 19

Steps

Other hands-on work on the same topics.

Guided tours through the source of real libraries that rely on it.