121 questions with answers
Senior React interviews test two things: how well you understand what React does under the hood (rendering, reconciliation, hooks, effects and state) and whether you can build a real, accessible component under time pressure. This list mixes both: concept questions with interview-ready answers and machine coding questions you solve in a live React editor.
1.Accordion
Build an accessible accordion with expandable sections and full keyboard support.
2.Contact Form
Build a contact form with accessible inline validation, a submitting state and a success message.
3.Data Table
Build a paginated users table with a rows-per-page selector and previous/next navigation.
4.Digital Clock
Build a ticking digital clock that stays aligned to real seconds, with a 12/24-hour toggle and clean timer teardown.
5.File Explorer
Render a nested folder/file tree where folders expand and collapse, sorted folders-first.
6.Generate Table
Generate a numbered table from row and column inputs, filled row by row, column by column or in a snake pattern.
7.Image Carousel
Build an accessible image carousel with previous/next controls, wrap-around and dot navigation.
8.Job Board
Build a paginated job board on a Hacker News-style API: fetch ids, then load job details in parallel pages.
9.Like Button
Build a toggle Like button that talks to a flaky API, with pending, error and accessible pressed states.
10.Memory Game
Build a card-matching memory game with timed flip-back, move counting and screen-reader friendly announcements.
11.Modal Dialog
Build a reusable modal dialog with a portal, labelled dialog semantics, Escape and backdrop dismissal, and focus restoration.
13.Progress Bars
Each click adds a progress bar that fills from 0 to 100% over two seconds, driven by requestAnimationFrame.
14.Selectable Cells (Drag Select)
Build a grid where dragging selects a rectangle of cells, with modifier-key multi-select and a full keyboard equivalent.
15.Sign-up Form Validation
Build a sign-up form with on-blur validation, a live password checklist, cross-field checks and a show-password toggle.
16.Star Rating
Build a star rating input with hover preview, keyboard support and a clear button, built on native radios.
17.Stopwatch
Build an accurate stopwatch with start, stop, lap and reset, based on timestamps rather than counting ticks.
18.Tabs
Build a tabs component that shows one panel at a time, with the correct tab roles and selected state.
19.Tabs II: Keyboard Accessible
Add roving tabindex, arrow-key navigation and automatic or manual activation to a tabs component.
20.Tic-tac-toe
Build a two-player tic-tac-toe game with win and draw detection, a live status and a keyboard-navigable board.
21.Toast Notifications
Build a toast system with a context API, live-region announcements, auto-dismiss that pauses on hover or focus, and a visible limit.
22.Todo List
Build a todo list with add, complete, delete and filters, using semantic forms and good focus management.
23.Tooltip and Popover
Build an accessible hover/focus tooltip and a click-triggered popover, and explain when to use each.
24.Traffic Light
Build a traffic light that cycles through configurable states with timers, a pause control and clean effect teardown.
25.Transfer List
Move checked items between two lists with per-list select-all and bulk transfer controls.
26.Users Database (CRUD)
Build a small users database with search, a keyboard-accessible listbox, and create, update, delete and cancel actions.
27.Whack-a-Mole
Build a timed whack-a-mole game with random moles, scoring, a countdown and keyboard play, managing several timers safely.
28.Wordle
Build a Wordle clone with physical and on-screen keyboards, correct duplicate-letter scoring and accessible feedback.
29.What is the consequence of using array indices as the value for `key`s in React?
Why index keys move state and DOM to the wrong rows, and when they are safe.
30.How do you handle asynchronous data loading in React applications?
Server Components and loaders, query libraries, careful effects, Suspense and use().
31.What are the benefits of using hooks in React?
Reusable stateful logic, co-location by concern, and no classes.
32.What is code splitting in a React application?
Dynamic import, lazy and Suspense, route-level splitting and prefetching.
33.What is the difference between controlled and uncontrolled React components?
Who owns the value, React state or the DOM, and the trade-offs of each.
34.How does virtual DOM in React work? What are its benefits and downsides?
Render, diff with type and key heuristics, commit, and the costs of doing so.
35.How would you optimize the performance of React contexts to reduce rerenders?
Stable values, split contexts, state/dispatch separation and selector-based stores.
36.What is the purpose of the `key` prop in React?
Keys give list items stable identity for reconciliation and state.
37.What are Actions in React 19? Explain `useActionState` and `useFormStatus`
Async transitions for mutations with built-in pending, error and form-reset handling.
38.What are some React anti-patterns?
Derived state, effect chains, nested component definitions, mutation and more.
39.What is the React Compiler and how does it change memoization?
Build-time automatic memoization, its reliance on the Rules of React, and adoption.
40.Explain the composition pattern in React
children, slots and compound components instead of inheritance and prop explosions.
41.What are some pitfalls about using context in React?
Re-render cascades, unstable values, overuse and missing providers.
42.What are some common pitfalls when doing data fetching in React?
Races, missing cleanup, waterfalls, missing caching and stale copies of server data.
43.What are error boundaries in React for?
Containing render errors with fallback UI, what they miss, and React 19 changes.
44.Explain what React hydration is
How React adopts server-rendered HTML and makes it interactive, and what changed in 18 and 19.
45.What causes hydration mismatch errors in React and how do you fix them?
Non-deterministic render, client-only APIs, locale, invalid nesting, and the fixes.
46.What is reconciliation in React?
How React decides which instances to keep, update or remount, based on type, position and key.
47.What are React Server Components and how do they differ from SSR?
Server-only components that ship no JS, the use client boundary, and how RSC complements SSR.
48.Explain server-side rendering of React applications and its benefits
Per-request HTML, hydration, streaming SSR and the trade-offs against CSR and SSG.
49.How do you decide between using React state, context, and external state managers?
Classify state as server, URL, local or shared, then pick the simplest fitting tool.
50.What is React Strict Mode and what are its benefits?
Development-only checks: double rendering, effect re-runs, ref checks and deprecation warnings.
51.What is React Suspense and what does it enable?
Declarative loading boundaries for lazy code, data, streaming SSR and selective hydration.
52.How does Suspense work for data fetching, and why doesn't it work with `useEffect`?
Suspense-enabled sources, render-as-you-fetch, and cached promises.
53.What does the `use` API do in React 19 and how is it different from other hooks?
Reading promises and context during render, conditional calls, and the cached-promise rule.
54.What is the `useCallback` hook in React and when should it be used?
Stable function identities, when they matter, and the React Compiler.
55.What is the `useMemo` hook in React and when should it be used?
Caching expensive calculations and stable identities, and when not to bother.
56.What is the `useRef` hook in React and when should it be used?
A persistent mutable box for DOM nodes and values that don't affect rendering.
57.Explain `useTransition` and `useDeferredValue` and when to use each
Marking updates as non-urgent so concurrent React keeps input responsive.
58.What are the rules of React hooks?
Top-level only, React functions only, why call order matters, and lint enforcement.
59.What is the purpose of callback function argument format of `setState()` in React and when should it be used?
Updater functions compute next state from the latest queued state.
60.What is the difference between state and props in React?
Props are inputs owned by the parent; state is memory owned by the component.
61.Why do my effects run twice in development, and how should I fix it?
Strict Mode's mount-unmount-mount check and how to write symmetric cleanups.
62.How do you test React applications?
A layered strategy built on Testing Library, user-event, MSW and E2E tests.
63.What does the dependency array of `useEffect` affect?
When effects re-synchronize, Object.is comparison, and stale closures.
64.What is the difference between `useEffect` and `useLayoutEffect` in React?
Effect timing relative to paint, and when blocking paint is worth it.
65.Explain what happens when the `useState` setter function is called in React
Enqueue, schedule, batch, render, reconcile, commit, and the state snapshot.
66.What is JSX and how does it work?
How JSX compiles to element-creating calls and the rules that follow.
67.What does re-rendering mean in React?
Render vs commit, what triggers re-renders, and when they become a problem.
68.What is React? Describe the benefits of React
What React is, why teams choose it, and its honest trade-offs.
69.What is virtual DOM in React?
An in-memory description of the UI that React diffs to update the real DOM.
70.Why does React recommend against mutating state?
Reference equality, memoization, snapshots and concurrent rendering all assume immutability.
71.Accordion II: Single Open, Controlled
Extend an accordion so only one section is open at a time, with optional collapsing and a controlled API.
72.Analog Clock
Draw a ticking analog clock in SVG with correctly rotated hour, minute and second hands and an accessible name.
73.Auth Code Input
Build a one-time-code input split into digit boxes with auto-advance, backspace, arrow keys and paste support.
74.Autocomplete / Typeahead
Build an accessible combobox that searches an async API with debouncing, caching and race-condition handling.
75.Birth Year Histogram
Bucket a list of birth years into a bar-chart histogram with adjustable bucket size and an accessible data-table view.
76.Connect Four
Build Connect Four with gravity drops, last-move win detection, column-based keyboard controls and announced moves.
77.Data Table II: Sorting and Filtering
Add sortable column headers and a search filter to a paginated users table.
78.Data Table III: Generic Columns
Turn a users-only table into a reusable DataTable driven by column definitions with renderers, sorting and typed filters.
79.Date Picker
Build a date input with a calendar dialog following the WAI-ARIA date picker pattern: grid keyboard navigation, focus trap and return.
80.Dice Roller
Roll a chosen number of six-sided dice, draw each face with CSS pips and announce the total accessibly.
81.Drag-and-Drop Sortable List
Build a reorderable list with pointer dragging and a full keyboard alternative: pick up, move, drop or cancel, with announcements.
82.Dropdown Menu
Build an accessible menu button: open and close, arrow-key and typeahead navigation, outside click and focus return.
83.File Explorer II: Keyboard Tree
Turn a file explorer into a WAI-ARIA tree view with roving focus, arrow-key navigation and type-ahead.
84.Flight Booker
Build a one-way or return flight form with date constraints, disabled states and a booking confirmation.
85.Grid Lights
Build a grid of toggle lights that, once all are lit, switch off one by one in reverse activation order.
86.Hello World Counter
Build a counter with increment, decrement and reset that never drops below zero and announces its value.
87.Holy Grail Layout
Build the classic header, three columns and footer layout with CSS Grid, landmarks, a sticky footer and responsive stacking.
88.Image Carousel II: Infinite Transitions
Extend the image carousel with sliding animations that loop seamlessly in both directions.
89.Infinite Scroll Feed
Build a cursor-paginated feed that loads more posts as you scroll, with abort handling, retries and the ARIA feed pattern.
90.Kanban Board
Build a kanban board with normalised state, adding and deleting cards, and moving cards between columns by pointer or keyboard.
91.Mortgage Calculator
Calculate the monthly payment, total cost and total interest of a fixed-rate loan as the user types.
92.Multi-step Form Wizard
Build a three-step sign-up wizard with per-step validation, a progress indicator, focus management and a review step.
93.Nested Checkboxes
Build a checkbox tree where parents reflect their children as checked, unchecked or indeterminate.
94.Pixel Art Editor
Build a 16×16 pixel-art editor with a colour palette, draw/erase tools, click-and-drag painting and keyboard drawing.
95.Progress Bar
Build a reusable, accessible progress bar that clamps its value and shows the percentage.
96.Progress Bars II: Concurrency Limit
Extend the progress bars so at most three fill at once while the rest wait in a queue.
97.Progress Bars III: Pause and Resume
Queue-limited progress bars that can be paused and resumed without losing progress, driven by one shared clock.
98.Temperature Converter
Two linked inputs, Celsius and Fahrenheit, that update each other and handle invalid input gracefully.
99.Tic-tac-toe II: N × N, M in a Row
Generalise tic-tac-toe to a configurable N × N board where M marks in a row win, with an efficient last-move win check.
100.Tweet Card
Build a social post card with semantic markup, relative timestamps, compact counts and accessible action buttons.
101.Virtualized List
Render a 10,000-row list smoothly by windowing: only the visible rows plus overscan are in the DOM.
102.How do you debug React applications?
DevTools, the Profiler, Strict Mode, lint rules and production error reporting.
103.How do you localize React applications?
Message catalogs, ICU MessageFormat, Intl, locale routing, RTL and translation workflow.
104.How has error handling changed in React 19?
Root error callbacks, de-duplicated logging, Action errors and boundaries.
105.How do refs work as a prop in React 19, and what are ref cleanup functions?
ref as a regular prop, the end of forwardRef, and callback ref cleanups.
106.What is React Fiber and how is it an improvement over the previous approach?
Incremental, interruptible reconciliation with priorities, the basis of concurrent React.
107.What is `forwardRef()` in React used for?
Passing refs through components, and why React 19 makes ref a regular prop.
108.What are React Fragments used for?
Grouping children without extra DOM nodes, keyed fragments, and state preservation.
109.What are higher-order components in React?
Component-in, component-out wrappers, their conventions, and why hooks replaced most of them.
110.What is the difference between React Node, React Element, and a React Component?
Components produce elements; elements are one kind of renderable node.
111.Explain one-way data flow of React and its benefits
Props down, events up, one owner per piece of state.
112.What are React Portals used for?
Rendering into another DOM node while staying in the React tree for context and events.
113.What are render props in React and what are they for?
Function props that delegate rendering, and where they still beat hooks.
114.Explain static generation of React applications and its benefits
Build-time HTML on a CDN, its freshness limits, and ISR-style hybrids.
115.How does streaming server-side rendering with Suspense work in React?
Shell first, boundaries streamed later, and selective hydration on the client.
116.What is the `useId` hook in React and when should it be used?
SSR-safe unique ids for accessibility attributes, and why not for keys.
117.How does `useOptimistic` work in React 19?
Optimistic overlays on real state during Actions, with automatic revert.
118.What is the `useReducer` hook in React and when should it be used?
Centralized, testable state transitions with a pure reducer and stable dispatch.
119.How do you reset a component's state in React?
State follows type plus position; change the key or reset explicitly.