๐Ÿ  Home๐ŸŽฎ Play Game Modes๐Ÿ† Daily Challenge๐Ÿค– AI Generatorโ„น๏ธ About Us๐Ÿ“ Quiz Blog๐Ÿ“ฌ Contact Us
๐Ÿ Home
Blog
๐Ÿ“React
โš›๏ธ
React

React Quiz: 20 Interview Questions and Answers for Frontend Developers (2026)

๐Ÿ“… July 16, 2026โฑ 11 min readโœ๏ธ QuizOxa Editorial Team

React remains the leading library for building modern user interfaces. With the release of React 19 and the widespread adoption of Server Components, interviewers have raised the bar, moving away from basic class components and focusing on hooks, concurrency, rendering states, and optimal performance patterns.

Below are 20 React quiz questions with clear answers and technical explanations. They cover essential concepts from state management and refs to newer hooks and React Server Components (RSC).

React Core Concepts & Hooks (1โ€“10)

Q1. What is the primary purpose of the Virtual DOM?

โœ… Answer: To batch and optimize real DOM updates, making UI updates faster

๐Ÿ’ก React keeps a representation of the UI in memory (Virtual DOM) and syncs it with the real DOM using a diffing algorithm (reconciliation).

Q2. What is the rule of thumb for using React Hooks?

โœ… Answer: Only call Hooks at the top level of your functional component (not inside loops or conditions)

๐Ÿ’ก React relies on the order in which Hooks are called. Conditional calls break the call sequence and cause bugs.

Q3. Which hook should you use to store a mutable value that does not trigger a re-render?

โœ… Answer: useRef

๐Ÿ’ก `useRef` returns a mutable ref object whose `.current` property can hold any value, without triggering a component update when it changes.

Q4. What is the difference between useMemo and useCallback?

โœ… Answer: useMemo memoizes the computed value of a function; useCallback memoizes the function definition itself

๐Ÿ’ก Use `useMemo` for expensive calculations. Use `useCallback` to prevent child components from re-rendering when passing callback props.

Q5. How does the useEffect cleanup function work?

โœ… Answer: It runs before the component unmounts and before the effect runs again

๐Ÿ’ก Returning a function from `useEffect` allows you to clear timers, cancel network requests, or clean up event listeners.

Q6. What happens when state changes in a React component?

โœ… Answer: The component and all of its child components re-render by default

๐Ÿ’ก State updates trigger a re-render. To prevent unnecessary child re-renders, you can wrap children in `React.memo`.

Q7. What is "prop drilling" in React?

โœ… Answer: Passing props through multiple nested child components that do not need the data themselves

๐Ÿ’ก Prop drilling can make code hard to maintain. It is solved by using React Context, state libraries (Redux/Zustand), or slot patterns.

Q8. What is the purpose of the key prop in React lists?

โœ… Answer: It helps React identify which items have changed, been added, or been removed

๐Ÿ’ก Keys must be stable, predictable, and unique among siblings. Using array index as keys is discouraged for dynamic lists.

Q9. How do you create a context in React?

โœ… Answer: Using the createContext function

๐Ÿ’ก `const MyContext = createContext(defaultValue);` creates a context container. Components consume it using the `useContext` hook.

Q10. What is the purpose of the useReducer hook?

โœ… Answer: To manage complex state transitions using a reducer function, similar to Redux

๐Ÿ’ก It is preferred over `useState` when state logic involves multiple sub-values or when the next state depends on the previous one.

๐Ÿ’ก Interview Strategy

Always mention performance hooks like `useMemo` and `useCallback` with caution. Emphasize that they have a memory overhead, and should only be applied when performance metrics justify it.

Advanced Rendering & React 19 features (11โ€“20)

Q1. What are React Server Components (RSC)?

โœ… Answer: Components that render exclusively on the server, sending pre-rendered HTML/JSON to the client

๐Ÿ’ก Server Components reduce bundle size by leaving server-only dependencies on the server, and improve page load times.

Q2. How do you designate a component as a Client Component in modern Next.js/React?

โœ… Answer: Add the "use client" directive at the very top of the file

๐Ÿ’ก All files are Server Components by default in modern frameworks. `"use client"` is required if the component uses hooks or event listeners.

Q3. What is the purpose of the Suspense component?

โœ… Answer: It lets you display a fallback UI while children are loading or resolving data async

๐Ÿ’ก `โšก <Suspense fallback={<Loader />}> <MyAsyncComponent /> </Suspense>` manages async loading boundaries declaratively.

Q4. Which hook was introduced in React 19 to handle transitions and pending states?

โœ… Answer: useTransition

๐Ÿ’ก `useTransition` returns a pending state and a function to wrap state updates, letting you run state transitions without blocking the UI.

Q5. What does the useActionState hook do in React 19?

โœ… Answer: It simplifies state management for form submissions (formerly useFormState)

๐Ÿ’ก It automatically handles form action state, pending status, and errors directly from action functions.

Q6. What is the difference between controlled and uncontrolled inputs?

โœ… Answer: Controlled inputs have state-driven values; uncontrolled inputs rely on DOM refs

๐Ÿ’ก Controlled inputs use `value` and `onChange`. Uncontrolled inputs use `ref` or `defaultValue`, letting the browser store input state.

Q7. What does code-splitting accomplish in a React application?

โœ… Answer: It loads JavaScript chunks dynamically on demand, reducing initial bundle size

๐Ÿ’ก Usually implemented using `React.lazy` and dynamic imports, code-splitting speeds up initial website loading.

Q8. What is the purpose of the useDeferredValue hook?

โœ… Answer: To defer updating a part of the UI until more urgent updates are completed

๐Ÿ’ก Useful for search filters. It keeps the typing input responsive while deferring the heavy filtered list update.

Q9. How do you handle errors inside React component trees?

โœ… Answer: By wrapping components in an Error Boundary

๐Ÿ’ก Error Boundaries are class components that catch JavaScript errors anywhere in their child component tree, rendering a fallback UI.

Q10. What is the purpose of the new "use" API in React 19?

โœ… Answer: It reads promises or context values conditionally inside loops or branch logic

๐Ÿ’ก Unlike hooks, `use` can be called inside conditional blocks and loops, offering a more flexible way to consume promises/context.

โš ๏ธ Common Mistake

Do not use `"use client"` everywhere. Client components should be pushed down to the leaves of your component tree. Keep static layouts as Server Components for fast initial loads.

Frequently Asked Questions

Should I learn Next.js or raw React?

Learn React fundamentals first. Once you understand state, props, and hooks, transition to Next.js, as modern React features (like Server Components) are built to be used within meta-frameworks.

Does React 19 support class components?

Yes, React 19 still supports class components for backward compatibility, but hooks are the modern standard, and class components cannot be used inside Server Components.

What is the best alternative to Redux for simple state management?

Zustand is highly popular due to its simple hook-based API, minimal boilerplate, and excellent performance. React's built-in Context API is also perfect for smaller apps.

๐ŸŽฏ Play the Technology Quiz

๐ŸŽฏTry These Quizzes

๐Ÿ’ป
Technology Questions
๐Ÿ“50 questions
๐Ÿ–ฅ๏ธ
Computer Science Questions
๐Ÿ“50 questions

๐Ÿ“šRelated Articles

1
๐ŸŸจ
JavaScript Quiz: 20 Questions Every Developer Should Know
Closures, the event loop, promises, and type coercion.
2
๐Ÿ—„๏ธ
SQL Quiz: 20 Questions and Answers for Interview Prep
Prepping for a database or backend interview.
โœ๏ธ
QuizOxa Editorial Team

Questions are written according to the official React documentation (v19) and standard modern frontend patterns.