Frontend

React interview questions

Interviewers probe how well you understand React's rendering model, hooks and their rules, state and effect management, and performance trade-offs. They look for reasoning about why React behaves as it does, not just API recall.

6 questions (1 easy · 2 medium · 3 hard), each with what a strong answer covers and where people lose the point. Free to read, no account.

On this page (6 questions)

1.What is the difference between state and props in React?

Warm-up

What 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.

Where people lose the point

  • 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.
Link to this question

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

Core

What 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.

Where people lose the point

  • 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.
Link to this question

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

Core

What 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.

Where people lose the point

  • 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.
Link to this question

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

Hard

What 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.

Where people lose the point

  • 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.
Link to this question

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

Hard

What 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.

Where people lose the point

  • 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).
Link to this question

6.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

What 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.

Where people lose the point

  • 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.
Link to this question
No account needed

Answer one real React question now

A question a React panel actually asks, answered out loud, scored on what you said and how you said it. Under two minutes, and nothing to sign up for.

What is the difference between state and props in React?

We never store the audio. Your answer is deleted within 24 hours unless you save the result.

How React answers get judged

The weights a React interviewer is holding, whether or not they say so out loud. Round Zero scores your practice answers against exactly these, and quotes your own words back as the evidence for each.

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 →

Now say them out loud

You have read what strong React answers contain. The next thing that moves the needle is producing one under time, out loud, and finding out where it falls apart.

  • These questions asked back, with follow-ups
  • Flashcards for the ones you keep missing
  • A scored mock that quotes your own answers

Browse every skill

Practising React: common questions

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. The React path runs free inside Round Zero: lessons, practice questions and flashcards. Drills are unlimited on every plan, free included. So is the full scorecard. Free also covers 3 complete scored interviews, no card.
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.