React
Rendering, hooks, state, effects and performance, from first component to concurrent React.
47 lessons 96 practice questions about 4 hours of reading
Chapter 1, beginner
Foundations
What it is and how it works, the questions every round starts with.
- 01What is the virtual DOM in React?
Lesson, 4 min read, then 5 questions to practise
- Implement a minimal React-like renderer with virtual DOM diffing and keyed reconciliation
- Parse a JSX-like string into a virtual DOM tree and render it back to escaped HTML
- Predict when React keeps or resets state: position, keys and component types
- Put React's update work in order: render and commit phases, what can be interrupted, and lanes
- Predict which React components re-render: memo, children props and context
- 02State vs props in React: what is the difference?
Lesson, 4 min read, then 5 questions to practise
- Build a list of independent counters: add, remove and reset, with a derived total
- Build a component that works both controlled and uncontrolled
- Choose useRef, state or a derived value, and prove it with render counts
- Reset a form when the selected record changes: keys versus derived-state bugs
- Build a controlled form with dynamic validation
- 03Why do lists need keys in React, and why not use the index?
Lesson, 4 min read, then 2 questions to practise
- 04Why does a React component re-render?
Lesson, 4 min read, then 2 questions to practise
- 06Class components vs function components in React
Lesson, 4 min read, then 4 questions to practise
- 08useState vs useReducer: when to use which?
Lesson, 5 min read, then 4 questions to practise
- Build a multi-step form as a useReducer state machine with no impossible states
- Build a calculator with useReducer: chained operations, backspace and divide-by-zero errors
- Predict how React batches state updates, including count + 1 versus updater functions
- Implement a small Redux-style store using subscriptions and reducers
- 09What are custom hooks in React?
Lesson, 4 min read, then 6 questions to practise
- Build everyday custom hooks: useToggle, useWindowSize, useOnlineStatus and useCopyToClipboard
- Build small state hooks: useBoolean, useCounter, useCycle, useStateWithReset, useDefault and useObject
- Build DOM interaction hooks: useHover, useFocus, useClickAnywhere, useKeyPress and useEffectOnce
- Implement useInterval() without stale closures
- Implement useEventListener() and useClickOutside() without re-subscribing every render
- Implement useFetch() with loading, error, and cancellation
- 10
- 11What are React hooks, and why were they added?
Lesson, 5 min read, then 4 questions to practise
- 13What does lifting state up mean in React?
Lesson, 4 min read
- 14What is conditional rendering in React?
Lesson, 5 min read, then 5 questions to practise
- Build Switch, Case and Default components
- Handle every data-fetching state: loading, error with retry, empty results, no stale data and abort
- Build tabs whose panels load on first view and keep their content: no duplicate loads, retry and hover preload
- Predict controlled and uncontrolled input values after typing, resetting state and changing key
- Build a schema-driven form with conditional fields and pluggable field types
- 15What is JSX in React?
Lesson, 5 min read, then 1 question to practise
- 16What is one-way data flow in React?
Lesson, 4 min read
- 17What is prop drilling, and how do you avoid it?
Lesson, 4 min read, then 3 questions to practise
- 18What is useRef used for in React?
Lesson, 4 min read, then 4 questions to practise
- Draw a circle that follows the cursor in a box, then only on click, with refs instead of state
- Implement usePrevious() without causing an additional render
- Predict the logs when React state and refs are mixed: batching, closures, timeouts and ref timing
- Fix a DOM node registry that leaks: callback refs with cleanup functions
- 19Why does React Strict Mode render components and run effects twice?
Lesson, 5 min read, then 4 questions to practise
- Predict side effects during render under StrictMode, Suspense and errors, then move them to effects
- Build useIsMounted, then replace it with an effect that aborts and ignores stale results
- Predict how many times effects run when dependencies are objects, arrays and functions
- Debug an infinite useEffect() loop and prevent stale asynchronous responses
Chapter 2, intermediate
In depth
How it behaves under the hood, and the follow-ups that come next.
- 20How does useEffect work: dependencies and cleanup
Lesson, 5 min read, then 1 question to practise
- 21What is reconciliation in React?
Lesson, 4 min read
- 22useMemo vs useCallback: what is the difference?
Lesson, 4 min read, then 1 question to practise
- 24How do React class lifecycle methods map to hooks?
Lesson, 4 min read
- 25How do you debug a React app?
Lesson, 5 min read, then 2 questions to practise
- 26How do you fetch data in React?
Lesson, 6 min read, then 3 questions to practise
- 28How do you optimize React performance?
Lesson, 4 min read, then 1 question to practise
- 29How does client-side routing work in React?
Lesson, 6 min read, then 4 questions to practise
- Implement a basic client-side router using the History API
- Build a route matcher with params, optional segments and wildcards, ranked by specificity
- Build nested route loaders and actions: parallel loading, <Outlet>, pending UI, aborts and revalidation
- Restore scroll positions in a single-page app: save per history entry, restore on Back, reset on new navigation
- 30How does forwardRef work, and what changed in React 19?
Lesson, 9 min read, then 3 questions to practise
- 31How does useContext work in React?
Lesson, 5 min read
- 32Presentational vs container components: is the pattern still useful?
Lesson, 4 min read, then 1 question to practise
- 33React element vs component vs node: what is the difference?
Lesson, 4 min read
- 34useEffect vs useLayoutEffect: what is the difference?
Lesson, 4 min read, then 1 question to practise
- 35Virtual DOM vs Shadow DOM: what is the difference?
Lesson, 5 min read, then 3 questions to practise
- 36
- 37What are error boundaries in React?
Lesson, 4 min read
- 38What are higher-order components in React?
Lesson, 5 min read
- 39What are portals in React?
Lesson, 4 min read, then 2 questions to practise
- 41What are the most common React anti-patterns?
Lesson, 4 min read
- 42What is hydration in React?
Lesson, 5 min read, then 4 questions to practise
- 43What is React.memo and when should you use it?
Lesson, 4 min read, then 1 question to practise
- 44What is state batching in React?
Lesson, 4 min read
- 45What is the render props pattern in React?
Lesson, 4 min read
Chapter 3, advanced
Senior level
Trade-offs, edge cases and the questions senior rounds end on.
- 46useDeferredValue vs useTransition: when to use which
Lesson, 5 min read, then 4 questions to practise
- 47What is React Fiber?
Lesson, 4 min read