React Senior interview questions and answers
75 questions for a React (Senior) interview - with correct answers, explanations and links to the docs.
Take this quiz- 1.Why is React's
cache()useful in Server Components? - 2.What is Fiber in React?
- 3.How does the render phase differ from the commit phase?
- 4.What does concurrent rendering give the user?
- 5.What happens during hydration?
- 6.Which code in render typically causes a hydration error?
- 7.What is selective hydration in React 18+?
- 8.How does streaming SSR (
renderToPipeableStream) work? - 9.How do Server Components differ from client components?
- 10.What does the
'use client'directive at the top of a file do? - 11.How do you render a Server Component inside a client
<Modal>? - 12.Which props can't be passed from a Server Component to a Client Component?
- 13.What's important to remember about
'use server'functions in terms of security? - 14.What is
useEffectEventfor? - 15.What does the
<Activity mode="hidden">component (React 19.2) do? - 16.What is
useImperativeHandlefor? - 17.What does this hook do?
- 18.What is tearing in concurrent rendering?
- 19.Which of these scenarios causes a memory leak in a React app?
- 20.What's the most accurate way to find which components are slow during interaction?
- 21.Why doesn't
useContexthave "selectors", and how do people work around it? - 22.You need to render a list of 100,000 items. What should you do?
- 23.What happens to an error thrown during render if there's no error boundary above the component?
- 24.Why doesn't an already-shown Suspense fallback appear during a transition inside
startTransition? - 25.What changed in
startTransitionin React 19? - 26.What's new about callback refs in React 19?
- 27.How do you set
<title>and<meta>from a component in React 19 without third-party libraries? - 28.Does
useMemoguarantee the computation won't repeat with the same dependencies? - 29.When is it acceptable to call
setStatedirectly during render? - 30.When is
flushSyncjustified? - 31.What is
createListenerMiddlewarein Redux Toolkit for? - 32.How do you do an optimistic update in RTK Query?
- 33.What is the signature of a Redux middleware?
- 34.Why don't you put promises, class instances and functions into the Redux store?
- 35.What is structural sharing in TanStack Query?
- 36.How do you correctly pass TanStack Query data loaded on the server to client components?
- 37.Why can't you use a single global
QueryClientfor all requests on the server? - 38.How do you properly support request cancellation in TanStack Query?
- 39.How does
useSuspenseQuerydiffer fromuseQuery? - 40.What must you specify in
useInfiniteQuery? - 41.Do you need Redux or Zustand if server data is already in TanStack Query?
- 42."Invalid hook call" error. What's the most likely cause if the component code is correct?
- 43.What principle underlies React Testing Library?
- 44.What are headless UI components, and why are they chosen for design systems?
- 45.How does
keyon a wrapper component differ fromkeyinside a list? - 46.What are the
preloadandpreinitAPIs fromreact-domin React 19 for? - 47.Why can
React.memowith a custom comparison function be dangerous? - 48.How does React 18+ handle
setStateon an unmounted component? - 49.What does TanStack Query give you compared to loading data in
useEffectwithuseState? - 50.When does RTK Query remove data from its cache?
- 51.What does
prerenderfromreact-dom/staticdo differently from streaming SSR? - 52.What is sent to the browser when Server Components render?
- 53.Why does this component suspend forever (or refetch endlessly)?
- 54.What does
useDeferredValue(query, "")with an initial value change (React 19)? - 55.What does the React Compiler need from your code to optimize it safely?
- 56.When is
suppressHydrationWarningappropriate? - 57.What do the
onCaughtErrorandonUncaughtErroroptions ofcreateRoot(React 19) give you? - 58.Why can importing one icon from a big "barrel" file (
index.tsre-exporting everything) hurt? - 59.A text input at the top of a large page makes the whole page re-render on each keystroke. What is the simplest fix?
- 60.Why doesn't
<ExpensiveTree />re-render whenColorPickerstate changes here? - 61.What does a test warning "An update was not wrapped in act(...)" mean?
- 62.Why mock network requests with Mock Service Worker (MSW) rather than mocking
fetchin each test? - 63.Why does
useSyncExternalStoreaccept agetServerSnapshotargument? - 64.How do you guarantee a module with secrets is never bundled into client code?
- 65.Where does React (17+) attach its event listeners?
- 66.What does
<link rel="stylesheet" href="/chart.css" precedence="default" />inside a component do in React 19? - 67.How do you avoid a waterfall when a Server Component needs two independent requests?
- 68.How can a Server Component start a fetch but let a Client Component wait for it?
- 69.How do you let users retry after an error boundary shows a fallback?
- 70.How do you unit-test a custom hook?
- 71.Why is storing JSX elements in state usually a bad idea?
- 72.What does Immer's
producegive you for deeply nested state updates? - 73.Why might
onClick={() => select(item.id)}defeatmemoon 1000 list rows? - 74.What happened to
propTypeson function components in React 19? - 75.Why are error boundaries still written as classes (or provided by a library)?