React interview questions test hooks, component design, state management, rendering optimization, and the virtual DOM. React JS interviewers want to see that you can explain why a component re-renders and how you'd fix it when it renders too often. This page covers 40 real React interview questions with answers across four formats: multiple choice, written answers, spoken responses, and live coding challenges, the same mix used in modern technical interviews.
Practice each question in your browser with no signup required. Answers stay hidden until you attempt the question: type, speak, or code your response first, then compare it against the model answer. Questions range from fundamentals for your first developer job to scenario-based questions for senior roles, so you can find the gaps in your knowledge before the real interview.
40 questions with answersLast updated: Oct 19, 2026
Choose a question. Pick any of the 40 questions. They mix multiple choice, written, spoken, and coding, the same mix a real interviewer uses.
Attempt your answer. Select a multiple-choice option, type your written response, record a spoken answer, or write code in the editor.
Reveal the model answer. Once you have attempted the question, the model answer unlocks so you can compare it with yours.
Move to the next question. Track how many questions you have attempted with the progress bar at the top of the page.
Take a mock interview. When you are ready, try a full mock technical interview on Plaicer with AI-driven follow-up questions.
React Interview Questions and Answers
0 of 40 attempted
1Multiple choice
How would you describe React and what problems does it solve in UI development?
Attempt the question first to reveal the answer.
Answer
React solves: managing complex UI state, reusing components across applications, efficient DOM updates through Virtual DOM diffing. It enables building scalable, maintainable applications.
2Written answer
Describe React's purpose, component-based architecture, and ecosystem
Attempt the question first to reveal the answer.
Answer
React is a JavaScript library for building user interfaces with components. Component-based architecture breaks UI into reusable pieces. Each component manages its own state and props. Components compose together to build applications. React ecosystem includes: React Router for navigation, Redux or Context for state management, testing libraries like Jest and React Testing Library, build tools like Webpack or Vite. React is maintained by Meta and community. Huge ecosystem enables building complex applications.
3Spoken answer
Walk through how you would build a counter component with state management
This browser cannot record audio. Answer the question out loud anyway, then compare yourself against the model answer below.
Attempt the question first to reveal the answer.
Answer
I created a counter component with useState. Initial state 0. Button onClick handler calls setCount with count plus 1. Each update triggers re-render, displaying new count. Used useCallback to memoize handler to prevent unnecessary re-renders if component received other prop changes.
4Coding
Create a counter component that increments and decrements using useState
Build your React component here
Attempt the question first to reveal the answer.
Answer
function Counter() { const count, setCount useState 0; return div button onClick={() setCount(count + 1)} Increment /button button onClick={() setCount(count - 1)} Decrement /button p Count: {count} /p /div }
5Multiple choice
Explain JSX syntax and how it enables writing markup-like code in JavaScript
Attempt the question first to reveal the answer.
Answer
JSX looks like HTML but is JavaScript. Babel transforms JSX to React.createElement. Enables readable UI code. JavaScript expressions wrapped in braces.
6Written answer
Explain how JSX is transformed to JavaScript and React.createElement calls
Attempt the question first to reveal the answer.
Answer
JSX is syntactic sugar. Babel transpiler converts JSX to React.createElement calls. Example: div className hello transforms to React.createElement div classNamehello null children. JavaScript expressions in braces are evaluated. Attributes become props. Children become additional arguments. Understanding transformation helps debug and use JSX effectively. JSX is not valid JavaScript alone; requires build step.
7Spoken answer
Describe a situation where you had to lift state and how it improved component communication
This browser cannot record audio. Answer the question out loud anyway, then compare yourself against the model answer below.
Attempt the question first to reveal the answer.
Answer
Parent component had toggle state. Two sibling child components needed to coordinate: only one could be expanded. I lifted toggle state to parent. Parent passed state and setState via props to children. Children now communicate through parent callbacks. This made components independent and reusable.
8Coding
Build a controlled form component with input validation
Build your React component here
Attempt the question first to reveal the answer.
Answer
function Form() { const email, setEmail useState ''; const handleSubmit (e) => { e.preventDefault; if valid email setEmail ''; } return form onSubmit={handleSubmit} input value={email} onChange={(e) setEmail(e.target.value)} /form }
9Multiple choice
What are React components and how do functional and class components differ?
Attempt the question first to reveal the answer.
Answer
Functional components are functions returning JSX. Class components extend React.Component. Modern React prefers functional components with hooks. Both are equivalent in capability.
10Written answer
Explain functional components, class components, and why functional components are preferred
Attempt the question first to reveal the answer.
Answer
Functional components are JavaScript functions returning JSX. Simple, testable, lightweight. Class components extend React.Component, use this.state and lifecycle methods. More verbose. Modern React prefers functional components with hooks because they are cleaner, smaller bundle size, easier to compose and test. Hooks provide equivalent capabilities to class features. New projects should use functional components. Class components still work but are legacy.
11Spoken answer
Explain how you would fetch data in a component using useEffect
This browser cannot record audio. Answer the question out loud anyway, then compare yourself against the model answer below.
Attempt the question first to reveal the answer.
Answer
I used useEffect with empty dependency array to fetch on mount. API call inside effect returns data. useState stored fetched data. useEffect cleanup function cancelled requests on unmount preventing memory leaks. Added error handling and loading state. Dependency array with id parameter fetched when id changed.
12Coding
Fetch data from an API using useEffect with loading and error states
How does the Virtual DOM improve performance compared to direct DOM manipulation?
Attempt the question first to reveal the answer.
Answer
React compares old and new Virtual DOM tree. Identifies minimal changes needed. Batches updates for efficiency. Reduces reflows and repaints. Dramatically faster than updating entire DOM.
14Written answer
Describe diffing algorithm, reconciliation, and why Virtual DOM improves performance
Attempt the question first to reveal the answer.
Answer
React maintains Virtual DOM in memory. After state change, creates new Virtual DOM tree. Diffing algorithm compares old and new trees, identifies changes. Reconciliation applies minimal DOM updates. Batches multiple updates together. This avoids expensive reflows and repaints. Direct DOM manipulation requires updating entire sections; React updates only changed elements. Dramatically improves performance on complex applications.
15Spoken answer
Talk about debugging a performance issue caused by unnecessary re-renders
This browser cannot record audio. Answer the question out loud anyway, then compare yourself against the model answer below.
Attempt the question first to reveal the answer.
Answer
React DevTools Profiler showed components re-rendering unnecessarily. I added React.memo to prevent re-renders when props didn't change. useCallback memoized functions passed as props. useMemo memoized computed values. Identified that Parent re-renders triggered all children re-renders. Optimizations reduced re-renders significantly.
16Coding
Render a list of items with proper keys and click handlers
Build your React component here
Attempt the question first to reveal the answer.
Answer
function List() { const items = itemsArray; return ul {items.map(item => li key={item.id} onClick={() handleClick item.id {item.name} /li)} /ul }
17Multiple choice
Contrast props and state, explaining when to use each and data flow
Attempt the question first to reveal the answer.
Answer
Props are read-only data passed from parent to child. State is mutable data managed by component. State changes via setState trigger re-renders. Props changes also trigger child re-renders.
18Written answer
Explain unidirectional data flow, prop drilling, and composition over inheritance
Attempt the question first to reveal the answer.
Answer
Unidirectional flow: data flows down from parent to child via props. Children cannot directly modify parent state; they call parent callback functions. This predictability aids debugging. Prop drilling: passing props through multiple intermediate components. Solved with Context API or composition. Composition over inheritance: build components by combining smaller components rather than extending base classes. More flexible, reusable, maintainable.
19Spoken answer
Describe implementing a form with controlled components
This browser cannot record audio. Answer the question out loud anyway, then compare yourself against the model answer below.
Attempt the question first to reveal the answer.
Answer
I used controlled components: input value from state, onChange handler updates state. Select with value and onChange. Checkbox with checked and onChange. Form submit handler validates and submits. All form state managed in React, making validation and submission predictable.
20Coding
Use conditional rendering to show different UI based on state
Build your React component here
Attempt the question first to reveal the answer.
Answer
function Status() { const isLoggedIn, setIsLoggedIn useState false; return isLoggedIn ? p Welcome back /p : p Please log in /p }
21Multiple choice
Explain useState hook and how it enables state management in functional components
Attempt the question first to reveal the answer.
Answer
const state, setState = useState initialValue. Setter setState updates state and triggers re-render. Multiple useState calls allowed. Hooks enable replacing class state with cleaner functional syntax.
22Written answer
Describe state updates, closure behavior, and common useState patterns
Attempt the question first to reveal the answer.
Answer
useState returns array: state value and setState function. setState updates state and queues re-render. setState can take value or function for previous state. State updates are asynchronous. Multiple setState calls batch together. Closures capture current state; stale state can occur without proper dependencies. Common patterns: toggles with boolean, form state with object, arrays with spread operator or hooks like useReducer for complex state.
23Spoken answer
Explain how you would use Context API to manage theme switching
This browser cannot record audio. Answer the question out loud anyway, then compare yourself against the model answer below.
Attempt the question first to reveal the answer.
Answer
I created ThemeContext with createContext. ThemeProvider component managed theme state. useContext theme hook in consumers accessed current theme. Toggle button changed theme. CSS applied different styles based on theme. Context avoided prop drilling through many components.
24Coding
Create a custom hook that manages form input state
Describe useEffect and how to handle side effects with dependency arrays
Attempt the question first to reveal the answer.
Answer
useEffect runs after component renders. Dependency array controls execution: empty runs once, omitted runs every render, with dependencies runs when dependencies change. Cleanup function handles unmounting.
26Written answer
Explain side effects, cleanup functions, and dependency array optimization
Attempt the question first to reveal the answer.
Answer
Side effects are operations outside pure rendering: API calls, subscriptions, timers, DOM manipulation. useEffect runs after render. Return function from useEffect is cleanup, runs before re-render and on unmount. Dependency array optimizes: omitted means run every render, empty means run once on mount, with dependencies means run when dependencies change. Proper dependencies prevent bugs and unnecessary runs.
27Spoken answer
Walk through creating a custom hook for reusable logic
This browser cannot record audio. Answer the question out loud anyway, then compare yourself against the model answer below.
Attempt the question first to reveal the answer.
Answer
I created useLocalStorage custom hook: useState persists to localStorage, useEffect syncs changes, returns state and setter. useForm hook: manages form state with validation, returns values, errors, handleChange, handleSubmit. Custom hooks enabled reusing logic across multiple components without code duplication.
28Coding
Implement Context API for managing global theme state
Explain state lifting and when to move state up the component tree
Attempt the question first to reveal the answer.
Answer
When multiple child components need same state, move it to closest common parent. Parent becomes source of truth. Children receive state and setState via props. Enables synchronization.
30Written answer
Explain component communication, shared state patterns, and alternatives
Attempt the question first to reveal the answer.
Answer
Child to parent: callback functions passed via props. Parent calls setState in callback. Multiple children: lift state to common parent, pass state and setState via props. Siblings communicate through parent. Complex apps use Context API or state management like Redux. Composition enables encapsulating related components. Custom hooks enable sharing logic between components without component nesting.
31Spoken answer
Talk about handling error boundaries in React applications
This browser cannot record audio. Answer the question out loud anyway, then compare yourself against the model answer below.
Attempt the question first to reveal the answer.
Answer
Error boundaries catch errors in child component tree. I created ErrorBoundary class component with componentDidCatch lifecycle. Displayed error UI instead of crashing app. Wrapped risky components in boundary. Error boundaries don't catch event handler errors or async errors; try-catch handles those.
32Coding
Use useCallback to prevent unnecessary re-renders of child components
How does Context API solve prop drilling and enable global state management?
Attempt the question first to reveal the answer.
Answer
Create Context with createContext. Wrap tree with Provider. useContext hook accesses value. Eliminates passing props through intermediate components. Perfect for themes, auth, language.
34Written answer
Explain Context, Provider, and Consumer; compare to Redux
Attempt the question first to reveal the answer.
Answer
Context: createContext creates context object. Provider wraps component tree, provides value. useContext hook accesses value in consumers. Simple for small to medium apps. Redux: centralized store, actions, reducers. More complex setup. Better for large apps with complex state logic and middleware needs. Redux enables time-travel debugging. Context is built-in, Redux is external library.
35Spoken answer
Describe how you would test a React component
This browser cannot record audio. Answer the question out loud anyway, then compare yourself against the model answer below.
Attempt the question first to reveal the answer.
Answer
I used React Testing Library to test components. render renders component. screen queries found elements. userEvent simulates user interactions like clicks and typing. expect assertions verify behavior. Testing component with mock functions verified correct callbacks were called. Testing focused on user behavior not implementation details.
36Coding
Use useMemo to memoize expensive computations
Build your React component here
Attempt the question first to reveal the answer.
Answer
function Expensive() { const result useMemo (() => expensiveCalculation someValue, [someValue]); return div {result} /div }
37Multiple choice
Explain hooks and how they enable using state in functional components
Attempt the question first to reveal the answer.
Answer
Hooks enable functional components to use state, effects, context, and other features. Follow rules: call only at top level, never conditionally. Enables cleaner code than class components.
38Written answer
Explain useState, useEffect, useContext, useReducer, useMemo, useCallback and custom hooks
Attempt the question first to reveal the answer.
Answer
useState manages local state. useEffect handles side effects. useContext accesses context value. useReducer manages complex state with actions, alternative to multiple useState calls. useMemo memoizes computed values, prevents recalculation on every render. useCallback memoizes functions, prevents unnecessary re-renders of child components receiving function as prop. Custom hooks: functions starting with use, combine built-in hooks to create reusable logic.
39Spoken answer
Explain how you would optimize a large list rendering
This browser cannot record audio. Answer the question out loud anyway, then compare yourself against the model answer below.
Attempt the question first to reveal the answer.
Answer
Virtual list rendering: only render visible items. react-window library virtualized list. Memoized row components with React.memo. Sorted large lists with efficient algorithms. useTransition deferred updates. Pagination instead of infinite scroll. Resulted in 60fps performance even with thousands of items.
40Coding
Build reusable components by composing smaller components
Build your React component here
Attempt the question first to reveal the answer.
Answer
function Card() { return div Card content /div } function CardList() { return div Card /Card Card /Card /div }
Topics covered
JSX and components: function vs class components, composition
Props vs state, unidirectional data flow
State: useState, lifting state up
Effects: useEffect, dependency arrays, cleanup, data fetching
Rendering: the virtual DOM, reconciliation, keys in lists
Performance: preventing unnecessary re-renders, large lists
Forms: controlled components and validation
Error boundaries, conditional rendering, and Redux vs Context
Frequently asked questions
How many React interview questions are on this page?
40 real React interview questions across four formats: multiple choice (10), written answer (10), spoken answer (10), and coding (10).
Do I need to sign up to practice?
No. All 40 questions and model answers are free with no signup. You attempt each question first, and the model answer unlocks once you have engaged.
Who are these React interview questions for?
Developers preparing for React technical interviews at any level, from first job to senior engineer roles. Questions cover fundamentals through real-world scenarios.
What topics do the React questions cover?
The questions cover components, props, and state. They also test hooks including useEffect, useMemo, useCallback, custom hooks, and the Context API. Other topics include rendering and the virtual DOM, performance, forms, and error boundaries.
Can I practice coding questions in the browser?
Yes. Coding questions include starter code in an in-browser editor, so you can write your solution without installing anything.
How often are the questions updated?
The question bank is reviewed regularly and updated to reflect current React interview patterns.
Can I take a full mock interview?
Yes. Plaicer's mock technical interview walks you through a realistic 30 to 45 minute interview with AI-driven follow-up questions.
Does the React content cover hooks and class components?
The questions focus on function components and hooks, which is what most React interviews test today. Class components appear only where comparing the two is useful.