Rehearse
Every interview question in the guide. Answer out loud first, then open the model answer and grade yourself honestly. Shaky and missed questions come back first in flashcard mode.
What problem does React solve, in one sentence?
What's the difference between imperative and declarative UI code?
Why does it matter that the DOM is stateful?
Is hand-written DOM code ever the better choice over a declarative framework?
What does "UI is a function of state" mean?
Why not re-render the whole page with innerHTML whenever state changes?
Why does it matter that the view function is pure?
In a redraw-everything renderer, why attach event listeners to the root instead of each element?
What would a renderer need in order to keep view(state) but stop losing DOM state?
What does JSX compile to?
What is a React element, and how is it different from a component?
Why do React elements have a $$typeof property?
Why must component names start with a capital letter?
Why does a component have to return a single root, and what does a Fragment do?
What changed with the automatic JSX runtime, and why?
How does a renderer treat a component differently from a DOM element like div?
What does createRoot(container).render(<App />) do, and is it synchronous?
Why are props read-only?
If you re-render by building the DOM from scratch each time, what goes wrong?
A component passes a new arrow function as onClick on every render. Does the renderer remove and re-add a DOM listener each time?
How does React's reconciliation (diffing) algorithm work?
Is the virtual DOM faster than the real DOM?
What happens to a component's state if its parent element changes from a div to a section?
Why shouldn't you define a component inside another component?
Does a component re-rendering mean the DOM was updated?
Does React compute a list of patches when it diffs?
Why does React need keys in lists?
What's wrong with using the array index as a key?
How can keys be used outside of lists?
How does React decide which keyed children to move?
What happens if you generate keys with Math.random() during render?
What is React Fiber and what problem does it solve?
What's the difference between the render phase and the commit phase?
Why must components be pure during rendering?
What are the current and work-in-progress trees?
Does React time-slice every render in React 18 and 19?
How does React decide when to yield to the browser?
Where does useState store its state?
Why do the rules of hooks exist?
Is setState synchronous? Why does console.log after setState print the old value?
A component deep in the tree calls its state setter. How does that update reach the screen?
What happens when you call setState with the same value?
Why is the setter from useState stable across renders, and why does it matter?
When does a useEffect callback run?
How does the dependency array work?
In what order do cleanups and effects run when dependencies change?
useEffect doesn't run anything when you call it. So where does the effect go, and how does React find it after the commit?
Why are effects flushed in a separate task after the commit instead of right after the DOM is updated?
If you've built a toy React, what are the main things real React adds?
What's the difference between props and state?
Is mutating something during render always a bug? Where exactly is the line, and how does StrictMode help you find it?
How do you use composition in React, and why is it preferred over inheritance?
A list item component needs its book's id. Why can't it read props.key?
What changed for custom elements in React 19?
Why does {count && <Badge />} sometimes render a 0?
What is a SyntheticEvent?
Walk me through what happens when a user clicks a button with an onClick in React.
Why did React 17 move event delegation from document to the root container?
What was event pooling, and what happened to it?
What happens when you mix native addEventListener calls with React handlers?
A handler calls setCount(count + 1) three times. What happens, and why?
What is automatic batching, and what changed in React 18?
What's a stale closure in React, and how do you avoid one?
Why must state be updated immutably in React?
How do you decide what belongs in state?
What decides whether a component's state is preserved or reset across renders?
What is a reducer, and how does useReducer work?
When do you choose useReducer over useState?
What can't you do inside a reducer, and where does that work go instead?
How should you design actions?
How does Immer help with reducers, and what does it cost?
What's the difference between useRef and useState?
When does React set a DOM ref, and why can't you read it during render?
How did React 19 change passing refs to components?
What's a ref callback, and what changed about them in React 19?
When would you use useImperativeHandle?
What are Fragment refs in React 19.3, and what problem do they solve?
What is useEffect for, and how should you think about it?
Why does my effect run twice in development?
What's the race condition when fetching in an effect, and how do you fix it?
How do dependencies work, and what goes wrong if you leave one out?
How do you decide between an event handler and an effect?
Give examples of effects you'd remove in code review.
What's the difference between useEffect, useLayoutEffect and useInsertionEffect?
What problem does useEffectEvent solve?
A parent and its child both have effects. In what order do they run, on mount and on update?
What problem does context solve, and how do you use it in React 19?
What re-renders when a context value changes?
How do you keep a context from causing unnecessary re-renders?
What happens if a provider passes value={{ user, setUser }}?
When would you not use context for state?
How is use(Context) different from useContext(Context)?
If two components call the same custom hook, do they share state?
Why do custom hooks have to start with use? What happens if you break the convention?
Why does useId exist? Why not Math.random() or a global counter?
Why use useSyncExternalStore instead of useState plus a subscribing useEffect?
What happens when getSnapshot returns a new object every time it's called?
What makes a custom hook well designed?
What are compound components and how do you implement them?
How do you design a component that can be both controlled and uncontrolled?
Why did hooks replace higher-order components for most uses? When would you still write a HOC?
Are render props still relevant?
What is a headless component, and why have design systems moved toward them?
A shared Dialog component has grown 15 props: title, subtitle, icon, primaryLabel, footerAlign and so on. Every new design adds another. What would you change?
What's the difference between a controlled and an uncontrolled input?
What causes the warning "A component is changing an uncontrolled input to be controlled"?
Is React's onChange the same as the DOM change event?
Why doesn't a reset button clear a controlled form, and how do you fix it?
How do you approach validation in a React form?
A form has two submit buttons, Save and Publish. How does the submit handler know which was clicked?
Map the main class lifecycle methods to hooks.
Is useEffect(fn, []) the same as componentDidMount?
How does this.setState differ from a useState setter?
Why did React move from classes to hooks?
What is getDerivedStateFromProps for, and why is it usually the wrong tool?
What does getSnapshotBeforeUpdate do, and how would you get the same result with hooks?
What does an error boundary catch, and what doesn't it catch?
Why are error boundaries still class components?
What happens when a render error isn't caught by any boundary?
What are onCaughtError, onUncaughtError and onRecoverableError?
How do you decide where to put error boundaries, and how do you recover from an error?
What's an Owner Stack, and how is it different from a component stack?
When do you need a portal?
How do events behave inside a portal?
What does an accessible modal need beyond a portal?
What does <Profiler>'s onRender tell you?
Can you use <Profiler> in production?
What causes a React component to re-render?
Why does a child re-render when its parent re-renders, even if its props are the same?
A user types without pausing, and every keystroke interrupts a slow transition. Can that transition be starved forever?
How does React decide which update to process first?
What does flushSync do and when would you use it?
React 18 made rendering concurrent. So why does typing still lag when a slow component re-renders on each keystroke?
What is a transition in React?
How is useTransition different from debouncing?
When would you use useDeferredValue instead of useTransition?
What happens if you put a controlled input's value update inside startTransition?
How do async transitions work, and what's the catch with await?
What changed about transitions in React 19.3?
You wrapped a slow list update in startTransition but typing is still janky. What would you check?
What is an Action in React 19?
What does React do when a form's action prop is a function?
How does useOptimistic work, and how does it roll back a failed update?
Why does useFormStatus always return pending: false in some components?
How should you handle errors in Actions?
A user double-clicks submit on a form using useActionState. What happens?
What does it mean for a component to suspend?
Why must the promise passed to use() be cached? What happens if it isn't?
Compare fetch-on-render, fetch-then-render and render-as-you-fetch.
What happens when an already visible Suspense boundary suspends again?
How does React decide when to reveal Suspense content?
How does lazy() work, and where should you use it?
How do you handle a failed load with Suspense?
What does <Activity> do, and how is it different from conditional rendering?
How can Activity make a screen appear instantly?
How does <ViewTransition> work?
Why doesn't my ViewTransition animate when I call setState?
What is addTransitionType for?
Would you ship Activity and ViewTransition to production today?
What's the difference between actualDuration and baseDuration in the Profiler's onRender callback?
What are the Core Web Vitals, and what are the thresholds?
How does a slow React render show up in INP, and what can you do about it?
When would you use the React DevTools Profiler versus the Performance tracks in Chrome DevTools?
Why shouldn't you trust profiling numbers from the development build?
Your colleague wants to wrap every component in memo because DevTools shows lots of re-renders. What do you say?
What's the difference between memo, useMemo and useCallback?
Why does passing an inline object or arrow function break React.memo?
How can you avoid unnecessary re-renders without memo, useMemo or useCallback?
When does memoization waste effort, or make things worse?
A component is wrapped in memo and its props haven't changed. Can it still re-render?
Can you rely on useMemo to keep a value, for example to make sure an effect runs only once?
What are the risks of passing a custom comparison function to memo?
What problem does the React Compiler solve, and what does it do to your code?
Walk me through how the compiler works internally.
What happens when code breaks the Rules of React under the compiler?
Is the React Compiler production-ready? Would you enable it?
Does the compiler make useMemo and useCallback obsolete?
How do you configure the compiler and adopt it in an existing codebase?
How does list virtualization work, and what are its trade-offs?
How do you decide where to code split a React app?
Your bundle doubled in size this quarter. How do you find out why and stop it happening again?
How do images affect Core Web Vitals, and what do you do about it?
When would you use a web worker instead of useDeferredValue or startTransition?
Design a table that shows 100,000 filterable, sortable rows and stays responsive on a mid-range phone.
How do you decide where a piece of state should live?
Why shouldn't you keep server data in a client store like Redux or Zustand?
What happens when you store derived data in state and keep it in sync with useEffect?
What state belongs in the URL, and what goes wrong if you keep it in component state instead?
Your shared client state changes several times a second and many components read different parts of it. Context or a store, and why?
A team puts everything in one global store: API responses, modal flags, form drafts. What are the costs, and how would you migrate?
Why does context cause unnecessary re-renders, and why doesn't React.memo help?
What is tearing, why does concurrent rendering make it possible, and how does useSyncExternalStore prevent it?
Walk me through building a minimal global store with selectors for React.
You want a store hook to accept selectors like s => ({ a: s.a, b: s.b }). How do you build that, and where does the trick stop working?
What changes when a global store is used with server rendering?
What do you give up by moving state from React into an external store?
Walk me through what happens when a Redux action is dispatched.
Why must reducers be pure and state immutable? What breaks if they aren't?
How can createSlice reducers mutate state if Redux requires immutability?
When do you need createSelector, and how does it work?
Would you choose Redux for a new React app today? Defend your answer.
What's the difference between createAsyncThunk and RTK Query, and when do you use each?
How does Zustand work under the hood?
Why does useStore((s) => ({ a: s.a, b: s.b })) crash in Zustand 5, and how do you fix it?
A WebSocket handler, outside any component, needs to push messages into state that components display. How do you do that with Zustand, and what should you watch for?
How do you use Zustand safely with server rendering, for example in Next.js?
What do the persist, devtools and immer middlewares do, and does their order matter?
Zustand and Redux Toolkit both sit on useSyncExternalStore. How do you choose between them?
What is an atom in Jotai, and where does its value live?
How do derived atoms work, and how do they compare with selectors in Redux?
How do async atoms interact with Suspense and transitions?
When would you choose atoms over a single store like Zustand or Redux?
Does Jotai use useSyncExternalStore? What's the trade-off?
A codebase still uses Recoil. What's its status, and how would you migrate?
What is fine-grained reactivity, and how does dependency tracking work?
Why doesn't React use signals?
How does MobX's observer make a component re-render?
MobX or Valtio: how do they differ?
What's the status of signals in JavaScript itself?
What happens when a MobX action updates state after an await?
What does 'make impossible states impossible' mean in React state?
How do you write useReducer as a state machine, and where do side effects go?
What do statecharts add to plain state machines?
What's the actor model in XState v5, and how does it connect to React?
When is XState worth it, and when is it overkill?
What happens when you send an XState machine an event its current state doesn't handle?
What's the difference between server state and client state?
Explain staleTime versus gcTime in TanStack Query.
How should you design query keys?
Walk me through an optimistic update with rollback.
What happens when a user switches back to a tab running TanStack Query?
Two components on the same screen call useQuery with the same key. What happens on mount, and later when the data changes?
SWR or TanStack Query?
When should state live in the URL?
What's the difference between pushState and replaceState, and when do you use each?
Why is React Hook Form uncontrolled, and what does that buy you?
What does Zod give you that TypeScript types don't?
How does a schema plug into React Hook Form, and what happens on submit?
If the form validates with Zod on the client, why validate again on the server?
Redux or Zustand for a new app?
Does the React Compiler fix the re-render cost of Context?
A team is committed to Redux and keeps API responses in hand-written slices with loading and error flags. What do you propose, without telling them to drop Redux?
Do we still need state management libraries with Server Components?
Is it ever right to copy a prop into state?
A product search page has results from an API, filters, a sort order, a selected row, a compare tray that persists across pages, a draft review form and a results count. Where does each piece live?
What are the trade-offs between client-side rendering and server-side rendering?
Explain SSR, SSG and ISR. When would you use each?
What problem does streaming SSR solve, and how does it work?
What is Partial Prerendering and how is it different from streaming SSR?
Are Server Components a replacement for SSR?
How do Astro's islands and Qwik's resumability compare with React's approach?
What is hydration, and why is it needed?
What causes hydration mismatches and how does React 19 handle them?
What happens on the wire when React streams a Suspense boundary?
What is selective hydration?
Why is renderToString considered legacy, and what replaced it?
How do prerender and resume enable partial prerendering?
React 19.3 added use(browser()). What does it do and when would you use it?
What are React Server Components?
What exactly does "use client" do?
What can you pass from a Server Component to a client component, and why those things?
How can a Server Component be rendered inside a client component?
What is the RSC payload and how does it get to the browser?
You wrapped getUser in React's cache(), but the database still sees several identical queries per request. What could be wrong?
What are the common mistakes teams make when adopting Server Components?
What is a Server Function, and how does calling one work?
What's the difference between a Server Function and a Server Action?
How do you secure Server Functions?
What does progressive enhancement mean for Server Functions?
What happens to variables captured by an inline Server Function?
What was the December 2025 React Server Components vulnerability, and what's the lesson?
What are React's taint APIs and how much should you rely on them?
What happens when a user navigates between two pages that share a layout?
Why can't app/dashboard/error.tsx catch an error thrown in app/dashboard/layout.tsx?
Why does useSearchParams need a Suspense boundary in Next.js?
Why are params and searchParams Promises since Next.js 15?
How do parallel and intercepting routes work together to build a modal?
How does Link prefetching work in Next.js 16, and what changed recently?
Why is checking authentication in a Next.js layout not enough?
After a Server Action writes data, how do you get the UI updated? Compare updateTag, revalidateTag, revalidatePath and refresh.
What's special about calling redirect() in a Server Action?
What is proxy.ts and what should and shouldn't go in it?
How do you use TanStack Query with the App Router?
What does after() do, and when would you use it?
Explain the Cache Components model in Next.js 16.
What's the difference between updateTag and revalidateTag in Next.js 16?
Why can't you call cookies() inside "use cache", and what do you do instead?
What is the static shell, and how does partial prerendering work under Cache Components?
In the previous caching model (Next.js 14 and 15), what were the four layers, and how did you track down a stale page?
You deploy a Cache Components app to a serverless platform and runtime cache hits are near zero. Why, and what do you do?
How do you choose between static, dynamic and ISR for a page in Next.js 16?
What's special about NEXT_PUBLIC_ environment variables?
Node.js or Edge runtime in Next.js today?
What do you need to configure to self-host Next.js across multiple instances?
With Cache Components, what happens when someone requests a dynamic page that generateStaticParams didn't list?
What changed between Next.js 14, 15 and 16?
In the Pages Router, what's the difference between getServerSideProps and getStaticProps?
How do Pages Router concepts map onto the App Router?
What's the biggest risk when upgrading a Next.js 14 App Router app to 15?
How would you approach caching in a React application?
What's the difference between Cache-Control no-cache, no-store, private and immutable?
Why do build tools put hashes in asset filenames, and how should HTML be cached?
What's the difference between React's cache() and Next.js "use cache"?
A user writes data and still sees the old value. How do you find the stale cache?
How would you start a new React app today?
Why was Create React App deprecated?
What does a bundler actually do?
Why is Vite's dev server fast, and how does HMR keep component state?
What's the difference between Babel, SWC, Oxc and tsc?
Next.js or React Router's framework mode: how would you decide?
How does client-side routing work under the hood?
Why do routers like React Router have loaders instead of fetching in components?
What are nested routes, and what does Outlet do?
What happens after a form submits to a route action in React Router?
React Router or TanStack Router: how do they differ?
What changed in React Router v7 and v8?
What's the difference between ReactNode, ReactElement and JSX.Element?
How do you type refs in React 19, including passing a ref to a child?
How would you model loading, error and success state in TypeScript?
When and how do you write a generic component?
How do you type a polymorphic as prop, and is it worth it?
Your Vite app builds and deploys with type errors in it. How is that possible, and what do you change?
What are the main ways to style React components, and their trade-offs?
Why doesn't runtime CSS-in-JS work well with Server Components?
How do CSS Modules work?
How does Tailwind decide which CSS to generate, and what bug does that cause?
Headless component library, styled kit, or shadcn/ui: how do you choose?
What is React Testing Library's philosophy, and why does it matter?
What does act() do, and what does the 'not wrapped in act' warning mean?
What's the difference between getBy, queryBy and findBy?
How would you mock API calls in component tests?
How do you balance unit, integration and end-to-end tests in a React app?
What shouldn't you test in a React codebase?
How do you make a React app accessible?
What does 'no ARIA is better than bad ARIA' mean?
What is an accessible name, and how is it computed?
What happens to focus on a client-side route change, and what should you do about it?
How do you announce an update that happens away from focus, like 'Saved'?
How should keyboard navigation work in a custom listbox, menu or tab list?
What does eslint-plugin-react-hooks check, and why does it matter more now?
exhaustive-deps says your effect is missing a dependency, but adding it causes a loop. What do you do?
What is ESLint flat config, and what changed in ESLint 10?
In React DevTools, what's the difference between a component's parent and its owner?
What does Storybook give you beyond unit tests?
React escapes output by default. How can a React app still have an XSS vulnerability?
A secret API key turned up in your client JavaScript. What are the ways that happens in a React or Next.js app, and how do you make it structurally hard?
What protects a Next.js Server Action against CSRF, and where does that protection stop?
How would you set up error monitoring for a React 19 app?
You want a strict CSP with nonces on a Next.js site. What does it cost?
How do you know whether your React app is fast for real users?
A deploy broke checkout. Walk me through rolling back, and what can make rollback fail.
Feature-based or layer-based folders? Defend your choice.
How do you keep module boundaries from eroding in a large codebase?
When are micro-frontends worth it, and when do they hurt?
What does a monorepo tool like Turborepo or Nx actually give you?
Where should data access live in a Next.js App Router app?
tRPC, GraphQL or OpenAPI: how do you choose?
What changed in React 18, and what did you have to do to get it?
What happens when you call two state setters inside a setTimeout, in React 17 versus React 18?
React 17 had no new features. Why did it matter?
What was removed in React 19, and which removals are dangerous?
How would you upgrade a large production app from React 18 to 19?
What's the difference between React's stable, canary and experimental channels? Next.js uses canary React. Is that a problem?
What have the React 19 minor releases added that you'd actually use?
Give me your mental model of React in about a minute.
How do you decide where a piece of state should live?
A React page feels slow. How do you find and fix the problem?
In a Next.js App Router app, trace a piece of data from the database to the screen, and then a button click that changes it.
When would you not use Server Components?
How do you design loading and error states across a React app?
What's a React misconception you hear often, and what's actually true?