Frontend

React interview questions & practice path

Hooks, rendering behavior, state patterns, and performance. Learn what interviewers probe, drill the questions until answers come fast, then prove it in a scored mock, all in one React path inside Round Zero.

  • Concept lessons that explain the why, not just the answer
  • Practice questions with adaptive follow-ups and flashcards
  • A scored mock with evidence quoted from your own answers

Sample React questions

What a strong answer covers, and the mistakes interviewers watch for. The scored path drills every one with live follow-ups.

What is the difference between state and props in React?

easy

A strong answer covers

  • Props are inputs passed down from a parent and are read-only within the receiving component; state is data a component owns and can update over time.
  • Updating state (via the setter from useState) schedules a re-render; you never mutate props or state directly.
  • Data flows one way: parent to child via props, and children communicate up by calling callback props the parent passed down.
  • A strong answer notes that lifting state up to a common ancestor is how sibling components share data.

Common mistakes

  • Saying you can change props from inside the component, or mutating this.props / a prop object.
  • Mutating state directly (e.g. state.push(x)) instead of producing a new value through the setter.
  • Confusing which one triggers a re-render, or claiming props changes never cause re-renders.

When do you reach for useEffect, and what problems come from overusing it?

medium

A strong answer covers

  • useEffect is for synchronizing with systems outside React: subscriptions, timers, manual DOM work, or data fetching, and it runs after the render is committed.
  • The dependency array controls when it re-runs; the returned cleanup function runs before the next effect and on unmount to prevent leaks.
  • Much logic mistakenly put in effects should instead be computed during render (derived state) or handled in event handlers; you don't need an effect to transform props into displayable data.
  • A strong answer mentions that effects run twice in development under StrictMode to surface missing cleanup, and that data fetching in raw effects has race-condition and waterfall pitfalls.

Common mistakes

  • Using an effect to sync one piece of state from another when it could just be derived during render.
  • Omitting cleanup for subscriptions, intervals, or event listeners, causing leaks and duplicate handlers.
  • Treating the StrictMode double-invoke as a bug rather than a signal that an effect isn't idempotent.

Why does React need a key prop on list items, and why is the array index often a poor key?

medium

A strong answer covers

  • Keys give each element a stable identity so React's reconciler can match elements between renders and decide what to reuse, move, or unmount instead of diffing purely by position.
  • With a correct stable key (like a database id), reordering or inserting items lets React move existing DOM and component state rather than recreating it.
  • Using the array index means identity is tied to position, so inserting or reordering shifts every key and can attach the wrong state (like input values) to the wrong item.
  • A strong answer notes index keys are acceptable only for static lists that never reorder, filter, or insert in the middle.

Common mistakes

  • Claiming keys are only there to silence the console warning.
  • Using the index as a key on a list that reorders or has items added or removed.
  • Generating a fresh random key (like Math.random) on every render, which forces full remounts and destroys state.

What do useMemo and useCallback do, and when are they actually worth using?

hard

A strong answer covers

  • useMemo caches a computed value and useCallback caches a function identity across renders, both recomputing only when their dependency array changes.
  • They matter when a referentially-stable value is needed downstream: passing a callback to a React.memo child, or avoiding an expensive recomputation on every render.
  • Without them, a new function or object is created each render, which breaks memoized children or effect/dependency comparisons that rely on reference equality.
  • A strong answer stresses they are not free: they add memory and comparison cost, so blanket-wrapping everything can be slower and just adds noise. The React Compiler now automates much of this.

Common mistakes

  • Wrapping every value and function reflexively without a measured reason.
  • Giving useCallback the wrong or empty dependency array so it closes over stale props or state.
  • Expecting useMemo to help when the child isn't memoized, so the referential stability buys nothing.

Walk through what happens when a component's state updates, from setState to the DOM.

hard

A strong answer covers

  • Calling the state setter schedules a re-render; React re-invokes the component function to produce a new element tree (the render phase), which is pure and has no side effects.
  • React reconciles the new tree against the previous one, diffing by element type and key to compute the minimal set of changes.
  • In the commit phase React applies those changes to the real DOM and then runs layout effects and effects; this phase is where mutations happen.
  • A strong answer mentions batching of multiple state updates into one render, and that concurrent features let React interrupt or reprioritize the render phase before commit.

Common mistakes

  • Claiming setState updates the DOM synchronously and immediately.
  • Saying React re-renders and repaints the entire DOM rather than diffing and applying minimal changes.
  • Conflating the render phase (pure, interruptible) with the commit phase (side effects, DOM writes).

You set an interval in a useEffect and it keeps reading the initial state value instead of the latest. What's happening and how do you fix it?

hard

A strong answer covers

  • The effect captured the state variable in a closure from the render when it ran; with an empty dependency array the interval callback keeps referencing that first snapshot.
  • One fix is the functional updater form, setCount(c => c + 1), which reads the latest value from React rather than the captured variable.
  • Alternatively, include the state in the dependency array so the effect re-subscribes with a fresh closure, remembering to clear the old interval in cleanup.
  • A strong answer notes useRef can hold a mutable latest-value that the callback reads, avoiding re-subscription while still seeing current data.

Common mistakes

  • Blaming React for being buggy instead of recognizing the stale closure over captured state.
  • Removing the dependency array entirely, which re-creates the interval on every render.
  • Adding the dependency but forgetting to clear the previous interval, stacking multiple timers.

How React answers are scored

Rendering mental model

40%

Explains how React renders and reconciles: components as functions of props and state, re-render triggers, the virtual DOM diff, keys, and commit vs render phases. Reasons about WHY, not just API names.

Hooks correctness

35%

Uses hooks correctly: the rules of hooks, accurate dependency arrays, closure and stale-state pitfalls, and choosing the right hook (state vs ref vs effect vs memo) for the job.

Communication and trade-offs

25%

Structures the answer, states assumptions, and weighs trade-offs honestly rather than cargo-culting optimizations like wrapping everything in useMemo.

Role tracks that include React

Related Frontend skills

All skills →

No spam. Unsubscribe anytime.

Ready to master React?

Sign up free. Your React path includes lessons, drills, flashcards, and a scored mock with feedback on what to fix.

  • Concept lessons plus practice questions
  • Flashcards for spaced repetition
  • A scored mock with evidence quotes

Questions & answers

What React interview questions should I practice?
Start with the core areas React interviewers probe: What is the difference between state and props in React; When do you reach for useEffect, and what problems come from overusing it; Why does React need a key prop on list items, and why is the array index often a poor key. This page outlines strong answers and common mistakes, and the scored path drills each one with follow-ups.
Is the React practice free?
Yes, you can start a React path free inside Round Zero. It generates lessons, practice questions, flashcards, and a scored mock. Sign up to unlock the full drills and your evidence-backed scorecard.
How is this different from a React question list?
A static list gives you questions with no feedback. Round Zero runs a live scored practice that probes your actual answers, rotates difficulty, and tells you exactly what to fix, grounded in a React rubric.
How should I prepare for a React interview?
Learn the concepts, drill the questions until answers come fast, then prove it in a scored mock. Round Zero sequences all three so you know you are ready, not just that you read about React.
How is a React answer scored?
React answers are scored on rendering mental model, hooks correctness, communication and trade-offs, with evidence quoted from what you actually said, so feedback is specific instead of generic praise.