React interview questions and answers for React developers

React interview questions focus on how rendering works: when a component re-renders, how state updates are batched, what effects are for, and why keys matter. Expect concept questions, a "what does this component show after one click" snippet, a live build of a small component, and for senior roles questions on performance, data fetching and app structure. The strongest answers explain React's model first and the API second.

By Published 7 min read

How React developer interviews are run

A React developer interview usually sits inside a frontend loop: one JavaScript round, one React round, sometimes a take-home, and a design discussion for senior candidates. The React round tends to be practical. You may get a component with a bug to fix, a small feature to build in a sandbox (a searchable list, a form with validation, tabs, a modal), or a set of questions about what a snippet renders.

  1. Concept questionsRendering, state, effects and keys. Interviewers listen for the mental model, such as "state is a snapshot per render".
  2. Predict the renderA component with a few state updates or an effect. Say what the screen shows and what is logged, and why.
  3. Build in a sandboxForty to sixty minutes on a small feature with loading, empty and error states. Structure and naming are graded along with correctness.
  4. Senior discussionHow you would organize state, fetch data, split bundles and test a large app, with trade-offs from your experience.

React fundamentals questions

Core React questions for freshers and mid-level developers
QuestionWhat it testsWhat a strong answer shows
What happens when state changes?Render modelReact calls the component again to get new JSX, compares it with the previous result, and applies only the needed DOM changes in the commit phase.
Props versus state?Data flowProps come from the parent and are read-only; state is owned by the component and changed through its setter. Data flows down, events flow up through callbacks.
What does JSX compile to?Under the hoodFunction calls that create element objects (jsx() with the modern transform, React.createElement before). Elements are plain descriptions, not DOM nodes.
Why do list items need a stable key?ReconciliationKeys tell React which item is which between renders. Index keys break when items are inserted, removed or reordered: input values and state follow the position, not the item.
Controlled versus uncontrolled inputs?FormsControlled inputs take value from state and update through onChange. Uncontrolled inputs keep their value in the DOM and are read through a ref or form data.
What does lifting state up mean?State placementMove shared state to the closest common parent and pass it down, so two siblings stay in sync.
What re-renders a component?Render triggersIts own state change, its parent re-rendering, or a context value it reads changing. A prop change alone is not the trigger; the parent's render is.
What is a fragment for?JSX structureReturning several elements without an extra DOM wrapper; the keyed form is needed inside lists.
Why must hooks be called in the same order every render?Rules of hooksReact matches hook state by call order. A hook inside a condition or loop shifts every slot after it.
What is the virtual DOM and is it why React is fast?Common mythIt is the element tree React diffs. The benefit is a declarative model with reasonable updates, not raw speed over hand-written DOM code.
Core React questions for freshers and mid-level developers. Scroll sideways on a small screen.

Hooks and state questions

function Counter() {
  const [count, setCount] = useState(0);

  function handleClick() {
    setCount(count + 1);
    setCount(count + 1);
    setCount(count + 1);
    console.log(count);
  }

  return <button onClick={handleClick}>{count}</button>;
}
Predict it: after one click, the button shows 1 and the console logs 0.

Each call uses the count from this render, which is 0, so all three schedule "set to 1". The log prints 0 because state is a snapshot: the variable does not change until the next render. With the updater form, setCount((c) => c + 1) three times, each update builds on the previous one and the button shows 3.

  • What is batching? Several state updates in one event are applied in a single render. Since React 18 with createRoot, updates inside timeouts, promises and native handlers are batched too.
  • When do you use useReducer instead of useState? When the next state depends on the previous in several ways, or many fields change together, so the transitions live in one tested function.
  • What is useRef for? A mutable box that survives renders without causing one: DOM nodes, timer ids, the latest value for a callback. Changing ref.current does not re-render.
  • How does context cause re-renders? Every component that reads a context re-renders when its value changes by reference. Creating a new object for the value on each provider render makes all consumers render each time.
  • What makes a good custom hook? It extracts stateful logic with a clear name and return value, such as useDebouncedValue or useOnlineStatus, and follows the rules of hooks itself.
  • Why should state be immutable? React compares references to decide what changed. Mutating an array and setting the same reference can skip the update.
  • Where should derived values live? Compute them during render from props and state. Copying them into state with an effect creates two sources of truth that drift.

useEffect questions

Effects get the most follow-up questions because they cause the most bugs. An effect synchronizes the component with something outside React, such as a subscription, a timer, a non-React widget or a network request. It runs after the commit, and its cleanup runs before the next run and on unmount.

function Timer() {
  const [seconds, setSeconds] = useState(0);

  useEffect(() => {
    const id = setInterval(() => setSeconds(seconds + 1), 1000);
    return () => clearInterval(id);
  }, []);

  return <p>{seconds}s</p>;
}
// Fix: setSeconds((s) => s + 1), so the closure no longer needs seconds.
Bug: the timer shows 1 and stops. The interval closure captured seconds from the first render.
useEffect(() => {
  let ignore = false;
  fetchUser(userId).then((user) => {
    if (!ignore) setUser(user);
  });
  return () => {
    ignore = true;
  };
}, [userId]);
Ignoring stale responses when the id changes faster than the network answers.
Effect questions and the answer behind each
QuestionWhat it testsWhat a strong answer shows
Why does my effect run twice on mount?StrictModeIn development, StrictMode mounts, unmounts and remounts to surface missing cleanup. Production runs it once. The fix is correct cleanup, not removing StrictMode.
An effect depends on an object created in render and runs every time. Why?Dependency identityA new object each render is a new reference. Depend on primitive fields, move the object inside the effect, or memoize it.
useEffect or useLayoutEffect?TiminguseLayoutEffect runs after DOM changes but before paint, for measuring layout and avoiding a flicker. Default to useEffect.
Do you need an effect to respond to a button click?Event versus effectNo. Logic caused by a user action belongs in the event handler. Effects are for syncing with something because the component is on screen.
How would you fetch data in a production app?Data fetchingA framework loader or a query library that handles caching, deduplication, retries and race conditions, rather than hand-written effects everywhere.
Effect questions and the answer behind each. Scroll sideways on a small screen.

Performance questions

  • What does React.memo do? It skips re-rendering a component when its props are shallowly equal to last time. It only helps if the props are actually stable.
  • useMemo versus useCallback? useMemo caches a computed value, useCallback caches a function. Both matter mainly when the result is passed to a memoized child or used as an effect dependency.
  • Should you wrap everything in memo? No. Measure with the React DevTools Profiler first. Unneeded memoization adds comparison cost and makes code harder to read.
  • How do you keep typing fast in a big filtered list? Keep the input state local, defer the expensive list with useDeferredValue or startTransition, and virtualize long lists.
  • How do you shrink the initial bundle? Route-level code splitting with React.lazy and Suspense, removing heavy dependencies, and loading rarely used widgets on demand.
  • What causes a cascade of renders from context? One large context holding fast-changing values. Split contexts by update frequency or move fast state into a store with selectors.

Senior React and scenario questions

Scenarios for experienced React developers
ScenarioWhat it testsWhat a strong answer shows
After deleting the second row, the third row's input shows the deleted row's text.KeysThe list uses index keys. Use a stable id from the data.
The server-rendered page logs a hydration mismatch.SSR and hydrationRender output differs between server and client: dates, random values, or reading window during render. Make the first client render match, then update in an effect.
One failing widget blanks the whole page.Error boundariesWrap independent regions in error boundaries with a fallback. They catch render errors, not errors in event handlers or async code.
Where should server data, form state and UI state live?State architectureServer data in a cache layer, form state in the form, UI state as local as possible, and a global store only for truly shared client state.
What changes with Server Components?Modern ReactIn frameworks that support them, components are server components by default: they run on the server, can read data directly and send no JavaScript of their own. Interactive parts opt in as client components with the "use client" directive, and they can use state and effects.
How do you test a component?TestingRender it with Testing Library, interact the way a user would (by role and label), and assert on what is visible. Mock the network at the boundary, not React internals.
A dashboard re-renders every widget every second.ProfilingProfile, find the shared state or context that changes every tick, then isolate that state to the widget that needs it.
Scenarios for experienced React developers. Scroll sideways on a small screen.

Fictional example

Answering "Tell me about a React performance problem you fixed"
Our admin table had about two thousand rows and typing in the filter box lagged badly. The Profiler showed that every keystroke re-rendered every row, because the filter text lived in a context that also held the selected rows, and each row read that context for its checkbox. I moved the filter text into the toolbar's own state, passed only the debounced value to the table, split selection into its own context, and virtualized the rows so only the visible ones mounted. Typing became smooth and the Profiler showed a handful of rows rendering per change instead of all of them. The lesson I took was to profile before adding memo, because the cause was where state lived, not missing memoization.

React practice plan

  • Week 1: rebuild five small components from memory: a counter with history, tabs, an accessible modal, a debounced search with loading and error states, and a form with validation. Narrate why each piece of state lives where it does.
  • Week 2: write ten predict-the-render snippets about snapshots, updater functions, effects, cleanup and keys, then check them in a sandbox.
  • Week 3 (senior): profile an app you own, write down one change you would make to its state architecture, and prepare a story about a production bug you traced to rendering or effects.

React sits on top of the language, so pair this page with JavaScript interview questions and, for typed codebases, TypeScript interview questions. The full frontend loop, including CSS and accessibility, is in frontend developer interview questions.

Building a component while talking is harder than either one alone. In a mock React round, Natively (an AI interview assistant for Mac and Windows) writes a transcript on your computer, so afterwards you can check whether you explained state placement or just typed. It can also read a component or prompt from a screenshot during practice and suggest an approach or code, and with Pro or the free trial it uses the résumé and job description you added. Past sessions stay in your history with their notes.

Questions people ask

What are the most common React interview questions?

What triggers a re-render, props versus state, why keys matter, how useState updates are batched, what useEffect is for and how its cleanup works, controlled inputs, and when memo, useMemo or useCallback help.

What do React developer interviews include besides questions?

Usually a live build in a sandbox, such as a searchable list, a form or a modal, plus a snippet where you predict what renders after a click. Senior rounds add state architecture and performance discussions.

Why does my useEffect run twice in development?

React StrictMode mounts, unmounts and mounts components again in development to expose effects without proper cleanup. It runs once in production.

How should I prepare for a senior React interview?

Be ready to explain where each kind of state should live, how you fetch and cache server data, how you profile and fix slow renders, and how you test components, using examples from your own work.

Where to go next

Practice with the same assistant you would use on a call: it listens, transcribes and suggests answers from your own resume and the job description.

Facts on this page were last checked on . Product details come from the Natively app itself; if something here is out of date, tell us at hello@heynatively.com.

Keep reading

Put it on your own machine.

A live-conversation assistant that runs locally. Your conversations stay on your machine.

macOS 12+ · Windows 10/11

© 2026 Natively AI Private Limited

Source-available under the Natively Personal Use Source License v1.0 · IP geolocation by DB-IP