Topics in this subject

31 topics

React

0 of 31 complete 0%
01 3 min read

Mental Model

React is declarative, component-based UI where UI = f(state) with one-way data flow over a Virtual DOM.

02 1 min read

JSX

JSX is syntactic sugar over React.createElement — expressions in braces, camelCase props, one root, no inline if.

03 3 min read

Components & Props

Function components take read-only props flowing parent→child; use children, defaults, spread, and Context to avoid drilling.

04 3 min read

State & useState

useState gives per-render snapshots; use functional updates, lazy init, batching, and immutable updates to avoid stale-state bugs.

05 4 min read

Rendering, Virtual DOM & Reconciliation

Render phase builds and diffs a Virtual DOM; commit phase applies minimal DOM mutations, with keys guiding reconciliation.

06 3 min read

Lists & Keys

Render arrays with .map and stable unique keys; avoid index keys, which cause state and DOM bugs on reorder.

07 2 min read

Conditional Rendering

Rendering UI conditionally with &&, ternary, early return null, JSX variables, and the 0-renders bug.

08 3 min read

Events

Synthetic events, camelCase handlers, passing arguments, preventDefault/stopPropagation, and root-level delegation.

09 3 min read

Forms

Controlled vs uncontrolled inputs, multiple fields, checkboxes/selects, submission, and when to reach for RHF.

10 3 min read

useEffect & Effects

Effects run after paint, dependency arrays, cleanup timing, and the stale-closure / infinite-loop / overuse pitfalls.

11 3 min read

Rules of Hooks

Call hooks only at the top level and only from React functions — why stable call order matters.

12 3 min read

useRef & the DOM

useRef for DOM access and mutable render-persistent values that don't trigger re-renders; forwardRef and pitfalls.

13 4 min read

useContext & Context API

Context shares values without prop drilling; every consumer re-renders on value change—memoize and split.

14 4 min read

useReducer

Reducer (state, action)=>newState centralizes complex state transitions; pair with Context for app-wide state.

15 4 min read

useMemo & useCallback

useMemo caches a value, useCallback caches a function reference—both for referential stability, not raw speed.

16 4 min read

React.memo & Performance

React.memo skips re-render on shallow-equal props; inline objects/functions/children break it—stabilize with hooks.

17 4 min read

Custom Hooks

Custom hooks extract reusable stateful logic; they share logic not state—each call gets isolated state.

18 3 min read

Composition & children

Compose components via the children prop and slots; favor composition over inheritance for flexible reuse.

19 3 min read

Error Boundaries

Class components that catch render/lifecycle errors in children and show a fallback UI instead of crashing.

20 3 min read

Portals

Rendering children into a different DOM node while keeping them in the React tree so events bubble normally.

21 3 min read

Suspense & Code Splitting

Lazy-load components with React.lazy and Suspense, split by route, and show fallbacks while chunks resolve.

22 3 min read

Concurrent Features

React 18 interruptible rendering with useTransition, useDeferredValue, and startTransition to keep the UI responsive.

23 3 min read

Other Hooks

Less-common hooks: useLayoutEffect, useId, useSyncExternalStore, useImperativeHandle, and useDebugValue.

24 4 min read

Data Fetching

Fetching in useEffect, avoiding race conditions, handling states, and why React Query/SWR win.

25 4 min read

Routing (React Router)

React Router v6+: routes, nested outlets, hooks, data router loaders/actions, and protected routes.

26 4 min read

State Management

Local vs lifted vs global state, when Context suffices, and Redux Toolkit, Zustand, Jotai/Recoil.

27 4 min read

Design Patterns

Custom hooks, compound components, render props, HOCs, and controlled vs uncontrolled components.

28 4 min read

Server Components & Next.js

React Server Components, the use client boundary, streaming, and Next.js App Router with server actions.

29 4 min read

Testing

React Testing Library philosophy, queries by role/text, userEvent, async findBy, and mocking fetch.

30 4 min read

Gotchas & Anti-patterns

Common React mistakes — keys, mutation, needless effects, stale closures — each with the fix.

31 4 min read

Cheat Sheet

Quick reference — all built-in hooks, JSX rules, effect deps, and a performance checklist.