Track 01 · 17 chapters · 99 topics
React.
Build interfaces out of small pieces that update themselves when your data changes.
Hello, React
What React is, and your first React element with zero tooling.
- 01Beginner3 min4 recall QsWhat is React?A JavaScript library that keeps the screen in sync with your data. You describe the UI, and React does the updating.
- 02Beginner3 min5 recall QsHello World, three waysThe same heading built with HTML, then plain JavaScript, then React, so you can see exactly what React adds.
- 03Beginner4 min4 recall QsNesting with createElementChildren, siblings and attributes using plain React.createElement, and why nobody writes UI this way for long.
npm, bundlers & a real project setup
Packages, versions and lockfiles, what a bundler actually does, and a modern Vite project with hot reload.
- 04Beginner4 min4 recall Qsnpm and package.jsonnpm downloads the code your app depends on. package.json is the list of what your project needs and the commands that run it.
- 05Core4 min5 recall QsVersions, the lockfile and node_modulesWhat ^ and ~ mean, why package-lock.json pins exact versions for everyone, and why node_modules never goes into git.
- 06Beginner3 min4 recall QsWhat a bundler doesA bundler turns your many source files and packages into a few small, fast files a browser can run. Here's every job it does.
- 07Beginner4 min5 recall QsA real React project with ViteOne command creates a React project with a dev server, a production build and sensible defaults. Here's what each file does, plus the Parcel way.
- 08Core3 min4 recall QsThe dev server, HMR and cachingWhile you code, the dev server rebuilds on every save and hot-swaps just the changed file, so the page updates and your state survives.
- 09Deep dive3 min4 recall QsBrowser targets and browserslistTell your build tools which browsers you support, and they rewrite modern syntax only as far back as needed. Missing features still need polyfills.
JSX & components
What JSX really compiles to, how it differs from HTML, and building UIs out of small function components.
- 10Beginner3 min4 recall QsJSX is just JavaScriptJSX is HTML-like syntax that a compiler turns into plain function calls before the browser ever sees it. Same objects as createElement, far easier to read.
- 11Beginner4 min4 recall QsJSX rules: how it differs from HTMLclassName, htmlFor, camelCase, closed tags, one root, style objects. The handful of rules that trip up everyone who knows HTML.
- 12Beginner3 min5 recall QsCurly braces: JavaScript inside JSXBraces open a window from markup back into JavaScript. Any expression fits; statements don't. Here's exactly what each kind of value renders.
- 13Beginner3 min4 recall QsFunction componentsA component is a JavaScript function that returns JSX. Give it a capital letter, use it like a tag, and you've built your own HTML element.
- 14Core3 min4 recall QsComposing componentsBuild big UIs from small components used inside each other. Render them as tags, never call them as functions, and never define one inside another.
- 15Core3 min4 recall QsJSX escapes text, and why that stops XSSReact shows strings as text, never as HTML, which blocks the most common web attack. Here's what it protects, the escape hatch, and the holes it can't close.
Props, lists & keys
Pass data into components, render lists from data, and pick keys that keep React's updates correct.
- 16Beginner4 min4 recall QsProps: passing data into componentsProps are a component's inputs. The parent writes them like HTML attributes, and the child receives them as one plain object.
- 17Core4 min4 recall Qschildren, read-only props & one-way data flowWhatever you nest inside a component arrives as props.children. Props only flow down, a child never edits them, and it asks the parent for changes through a callback.
- 18Beginner3 min4 recall QsRendering lists with mapTurn an array of data into an array of elements with .map(). Filter or sort a copy first, handle the empty case, and give every item a key.
- 19Core4 min5 recall QsKeys: how React tells list items apartA key is a stable, unique name for each item in a list. React uses it to match items between renders, so DOM and state stay with the right item.
- 20Core4 min4 recall QsConfig-driven UIBuild the screen from data instead of hard-coding it, so the same components can show different layouts per city, user or experiment. Plus safe reading of messy API data.
- 21Beginner4 min4 recall QsSplitting files: default and named exportsOne component per file, data in its own module, and the two ways files share code. Plus when a file must be .jsx instead of .js.
State, hooks & the virtual DOM
Why a plain variable can't update the screen, how useState does, and how React works out what changed.
- 22Beginner3 min4 recall QsWhy a plain variable won't update the screenChanging a normal variable doesn't re-render anything. State is data React keeps between renders, and changing it tells React to draw again.
- 23Beginner3 min4 recall QsuseState, step by stepDeclare a state variable, read it, and update it with its setter. Every update makes React call your component again with the new value.
- 24Core3 min4 recall QsState is a snapshot: batching & updater functionsInside one render, state never changes. React batches your updates and applies them after the handler, so use setCount(c => c + 1) when the next value depends on the last.
- 25Core4 min4 recall QsUpdating objects and arrays in stateNever change state in place. Build a new object or array with the change and set that, so React sees a new value and re-renders.
- 26Core3 min4 recall QsThe rules of hooksCall hooks at the top level of a component or custom hook, never inside conditions, loops or nested functions, because React matches hooks by the order you call them.
- 27Deep dive4 min5 recall QsVirtual DOM, reconciliation & FiberOn every update React builds a new tree of elements, compares it with the last one, and changes only the DOM that differs. Here's what it compares, and the myths to drop.
useEffect, fetching data & CORS
Run code after render with useEffect, fetch data properly, understand CORS, and turn raw data into searchable UI.
- 28Beginner4 min4 recall QsMonolith vs microservicesTwo ways to organise the servers behind your app. One big app that ships as a whole, or many small services that each do one job.
- 29Core5 min5 recall QsuseEffect, step by stepRun code after React updates the screen, like fetching data or starting a timer, control how often it re-runs, and clean it up when you're done.
- 30Core6 min5 recall QsFetching data with useEffectRender first, fetch in an effect, then fill in the data. Plus the three things tutorials skip, which are HTTP errors, cancelling, and stale responses.
- 31Beginner4 min5 recall QsLoading states, shimmer UI & conditional renderingShow the right screen for loading, error, empty and success, using early returns, ternaries and &&, with a shimmer that matches your layout.
- 32Core5 min5 recall QsCORS: why the browser blocked your fetchThe browser only lets your page read another origin's response if that server says so in its headers. What's blocked, what a preflight is, and the only real fixes.
- 33Core3 min4 recall QsSearch & filter: derive, don't copyKeep the full list in state, keep what the user typed in state, and calculate the visible list on every render. No lost data, no copies to keep in sync.
Routing & single-page apps
Add images the right way, then build a multi-page app with React Router, from first links to nested layouts and URL params.
- 34Beginner3 min4 recall QsFour ways to add imagesImport it, drop it in public/, point at a remote URL, or use it from CSS. Where the file lives decides who turns it into a URL.
- 35Beginner4 min4 recall QsSingle-page apps & client-side routingA multi-page app loads a new HTML page on every click. A single-page app keeps one page and swaps the content with JavaScript. How each works, and the trade-offs.
- 36Core4 min5 recall QsReact Router: first routes & linksInstall React Router, map URLs to components with createBrowserRouter and RouterProvider, link with <Link>, and catch 404s with errorElement.
- 37Core4 min4 recall QsLayouts with nested routes & OutletPut shared UI like the header in a parent route, render child routes into its <Outlet />, and highlight the current page with NavLink.
- 38Core4 min4 recall QsDynamic routes: useParams & useNavigateOne route like /menu/:id serves every dish. Read the id with useParams, link to it with a template string, and move users in code with useNavigate.
- 39Deep dive4 min4 recall QsHash & memory routerscreateHashRouter keeps the route after a
Class components & lifecycle
Read and write class components, follow the lifecycle step by step, and map it to hooks. Error boundaries included.
- 40Core4 min4 recall QsClass components, the old wayBefore hooks, stateful components were JavaScript classes. Learn to read one, why super(props) comes first, and why classes still matter.
- 41Core4 min4 recall Qsthis.state and setStateClass state is one object. setState merges your changes into it, applies them later in a batch, and has an updater form for building on the previous value.
- 42Core4 min4 recall QsThe lifecycle: mount, update, unmountA class component is born, changes and dies. React calls a method at each stage, split into a pure render phase and a commit phase where side effects belong.
- 43Core3 min4 recall QsLifecycle order with parents and childrenReact renders a tree top-down, writes the DOM once, then runs didMount bottom-up. Knowing the exact order answers a classic interview question.
- 44Core4 min4 recall QsFrom lifecycle methods to hooksMost lifecycle methods fold into one useEffect with a cleanup. Plus the classic question, why the useEffect callback can't be async, and the fix.
- 45Core4 min4 recall QsError boundariesA class component that catches render errors in its children and shows a fallback instead of a blank page. Still the one thing you can't do with a hook.
Custom hooks, lazy loading & memo
Keep components focused, reuse logic with custom hooks, load code only when needed, and know when memoisation helps.
- 46Beginner4 min4 recall QsSingle responsibility: one job per pieceSplit big components by job, not by size. Data logic goes in hooks, calculations in plain functions, and components just show things.
- 47Core5 min4 recall QsCustom hooksA function whose name starts with use and that calls other hooks. It lets components share stateful logic, like online status or fetching, without sharing state.
- 48Core5 min5 recall QsLazy loading with lazy and SuspenseSplit your app into chunks the browser downloads only when needed. lazy() loads a component on first render; Suspense shows a fallback while it arrives.
- 49Core4 min4 recall QsSuspense boundaries and startTransitionWhere to put Suspense so a loading chunk doesn't blank your page, the old "suspended while responding to synchronous input" error, and how startTransition keeps the old screen visible.
- 50Deep dive3 min5 recall QsReact.memomemo lets a component skip re-rendering when its props haven't changed. Useful for slow components; pointless for cheap ones; often automatic with the React Compiler.
- 51Deep dive5 min4 recall QsuseMemo and useCallbackuseMemo caches a calculated value between renders; useCallback caches a function. Use them for slow calculations and stable props, not everywhere.
Styling with Tailwind CSS
Every way to style React, then Tailwind CSS v4 from setup to responsive design, plus how the older v3 setup maps over.
- 52Beginner5 min5 recall QsWays to style a React componentInline style objects, CSS files, CSS Modules, Sass, CSS-in-JS and component libraries, with what each one is good and bad at.
- 53Beginner4 min4 recall QsTailwind CSS: the utility-first ideaStyle elements with small single-purpose classes like p-4 and font-bold, right in your JSX. Tailwind ships CSS only for the classes you actually use.
- 54Core4 min4 recall QsSetting up Tailwind CSS v4Install one build plugin, add one line of CSS, and define your own colours and fonts with @theme. No config file needed.
- 55Core4 min4 recall QsReading an older Tailwind v3 setupWhat tailwind.config.js (content, theme, extend, plugins) and .postcssrc did in Tailwind v3, and where each one lives in v4.
- 56Core3 min5 recall QsResponsive design, states and dark modePrefixes like md:, hover: and dark: switch a class on only at a screen size, in a state or in dark mode. Square brackets handle one-off values.
- 57Core4 min4 recall QsTailwind trade-offs and readable class listsThe honest pros and cons of Tailwind, plus the habits that keep long class lists tidy, like components, clsx and cn() for conditional classes.
Lifting state & Context
Share state between components without the mess, from lifting state up to Context, and when each one fits.
- 58Core4 min4 recall QsHigher-order componentsA function that takes a component and returns a new, enhanced one. Still handy for wrapping UI, but hooks replaced most of its old jobs.
- 59Core4 min4 recall QsControlled vs uncontrolled componentsWho owns the value, React state or the component itself? Controlled inputs and components take their value from props or state, uncontrolled ones keep their own.
- 60Core3 min4 recall QsLifting state up: one open section at a timeWhen two components need the same changing data, move the state to their closest common parent and pass it down as props, with a function to change it.
- 61Beginner3 min4 recall QsProp drilling, and two ways outPassing a prop through components that don't use it, just to reach one deep down. Fix it with composition (children) first, and Context when that's not enough.
- 62Core5 min5 recall QsContext: share data without passing propsCreate a context, wrap part of the tree in a provider with a value, and read it from any component below with useContext or use.
- 63Deep dive4 min5 recall QsUpdating context and keeping it fastPut state and its setter in the context value so children can update it, then control re-renders by memoising the value and splitting contexts.
Redux Toolkit
When an app needs a global store, and how Redux Toolkit's slices, store and hooks make one easy to build.
- 64Beginner4 min4 recall QsDo you need Redux?Props, Context or Redux? Pick by how many components need the data and how often it changes. Most state never needs Redux.
- 65Core4 min4 recall QsThe Redux loop: action, reducer, storeThe UI dispatches an action, a reducer computes the next state, the store saves it, and selectors hand fresh data back to the UI. Always one way.
- 66Core5 min4 recall QsRedux Toolkit: createSlice, configureStore, ProviderOne createSlice call gives you a reducer and its action creators. configureStore builds the store, and Provider hands it to your app.
- 67Core4 min4 recall QsImmer: writing reducers that look like mutationInside createSlice you can write state.items.push(x). Immer records the change on a draft and builds a new, immutable state for you.
- 68Core5 min4 recall QsuseSelector and useDispatch: a cart, end to endRead the smallest piece of state you need with useSelector, send actions with useDispatch, and the cart updates everywhere at once.
- 69Deep dive4 min4 recall QsRedux DevTools, async thunks and RTK QueryWatch every action in DevTools, run async work in thunks, and let RTK Query fetch and cache server data so you don't hand-write it.
Testing with Vitest, Jest & React Testing Library
Why and what to test, setting up a test runner, and testing components the way a user uses them.
- 70Beginner4 min4 recall QsWhy test, and which tests to writeAutomated tests re-check your app in seconds after every change. Unit, integration and end-to-end tests each catch different bugs.
- 71Core4 min4 recall QsSet up Vitest (or Jest) with React Testing LibraryInstall a test runner, a fake browser (jsdom) and the Testing Library packages, then point them at each other with a few lines of config.
- 72Beginner4 min4 recall QsYour first test: test, expect and matchersA test calls your code and checks the result with expect(…).toBe(…). Group tests with describe, share setup with beforeEach, and run them on every save.
- 73Core4 min4 recall Qsrender, screen and queries: finding things like a userrender puts a component into the fake DOM, screen finds elements in it, and jest-dom matchers check them. Reach for getByRole first.
- 74Core4 min3 recall QsSimulating clicks and typing with user-eventuser-event clicks and types the way a real person does, firing the full chain of browser events. Always await it.
- 75Core5 min5 recall QsFaking the outside world: fetch, Router and ReduxReplace fetch with a mock, wait for results with findBy, and wrap components in the same providers your app uses, with a fresh store per test.
Events & forms
Handle clicks and typing, follow events as they bubble, and build forms that validate kindly and submit cleanly.
- 76Beginner4 min4 recall QsResponding to eventsGive onClick, onChange and friends a function. React calls it when the event happens and passes an event object describing what happened.
- 77Core4 min5 recall QsThe React event objectYour handler gets a React event object, also called a synthetic event. It wraps the browser's event with the same standard fields, and the original is in e.nativeEvent.
- 78Core4 min5 recall QsBubbling, stopPropagation & preventDefaultAn event runs the clicked element's handler, then bubbles up through every parent's handler. stopPropagation stops the climb, and preventDefault stops the browser's own action.
- 79Core4 min5 recall QsControlled forms with many fieldsText, textarea, select, checkbox and radio all follow one pattern, value from state and onChange back to state. One object and one handler can run a whole form.
- 80Core6 min5 recall QsValidating forms the friendly wayCheck fields when the user leaves them or submits, clear errors as soon as they're fixed, wire each message to its input with aria attributes, and let required and pattern help.
- 81Core4 min5 recall QsFormData and form actionsSkip state and read every named field at once with new FormData(form). React 19 goes further, since form action={fn} handles the submit plumbing for you.
Refs & more hooks
Reach the DOM with refs, pass refs the React 19 way, and know when useReducer, useId, useLayoutEffect and useEffectEvent fit.
- 82Core6 min4 recall QsuseRef: remember without re-renderingA ref is a box with a .current property. It survives re-renders but never causes one. Use it for timer ids and to reach real DOM nodes.
- 83Core5 min4 recall Qsref as a prop, ref callbacks & useImperativeHandleIn React 19 a component takes ref like any other prop, so forwardRef isn't needed. Ref callbacks can return a cleanup, and useImperativeHandle exposes a small API.
- 84Core5 min5 recall QsuseReducer: state changes as actionsMove every way your state can change into one pure function. Handlers dispatch plain action objects that say what happened, and the reducer returns the next state.
- 85Core3 min4 recall QsuseId: unique ids for labels and inputsuseId gives each component instance its own stable id that matches on the server and in the browser. Use it to link labels, inputs and hints. Never use it for list keys.
- 86Deep dive3 min4 recall QsuseLayoutEffect: measure before paintSame shape as useEffect, but it runs after React updates the DOM and before the browser paints. Use it only to measure layout and fix it before the user sees a jump.
- 87Deep dive4 min5 recall QsuseEffectEvent: read the latest without re-runningSome code inside an effect should see the latest props but shouldn't make the effect re-run. Move it into an Effect Event with useEffectEvent, added in React 19.2.
React 19 & concurrent features
Actions, form hooks, optimistic UI, use(), deferred rendering, portals and Activity, the modern React toolkit.
- 88Core5 min4 recall QsActions: async functions in transitionsReact 19 lets a transition run an async function. React tracks the pending state, keeps the current screen usable, and plugs the same idea into form action.
- 89Core4 min5 recall QsuseActionState and useFormStatusLet a form's async action return its next state, such as errors and results, with useActionState. Show a pending button anywhere inside the form with useFormStatus.
- 90Core4 min4 recall QsuseOptimistic: instant UI that rolls backShow the result of an action before the server confirms it. If the action fails, React drops the guess and shows the real state again, with no undo code.
- 91Core3 min4 recall Qsuse(): read a promise or contextReact 19's use() reads a promise, suspending until it resolves, or reads context, even inside an if. The one rule is that the promise must outlive the render.
- 92Deep dive3 min4 recall QsDeferred values vs transitionsKeep typing instant while a slow list catches up. useDeferredValue lags a value behind; useTransition marks an update as non-urgent. Both need memo to help.
- 93Core4 min4 recall QsPortals and ActivitycreatePortal renders a modal somewhere else in the DOM while it stays in your React tree. Activity hides UI without unmounting it, so its state survives the switch.
React in the real world
Type your components with TypeScript, make them accessible, profile before you optimise, and structure a growing app.
- 94Core7 min5 recall QsReact with TypeScript: typing propsStart a TypeScript React project and describe each component's props, so typos and wrong values show up in your editor, not in front of users.
- 95Core5 min5 recall QsTyping state, events and refsWhen TypeScript can work out a hook's type by itself, when you must spell it out, and the event and ref types you'll use every day.
- 96Beginner5 min5 recall QsAccessibility: semantic HTML firstUse the right HTML element and your app works with a keyboard and a screen reader for free. Buttons, links, labels, alt text and page structure.
- 97Core6 min5 recall QsKeyboard, focus and ARIAKeep focus visible and in a sensible order, move it on purpose when modals open, reach for ARIA only when HTML can't do the job, and announce changes.
- 98Deep dive4 min5 recall QsProfiling: measure before you optimiseUse the React DevTools Profiler to see which components rendered, how long they took and why, then fix the real culprit instead of guessing.
- 99Core4 min5 recall QsProject structure that scalesGroup files by feature instead of by type, keep things next to where they're used, and know the traps of index.ts barrel files.
