Skip to the page

Rendering strategies and React · mid

React performance: re-renders, memoisation, transitions and the Compiler

In React, slow screens usually come from rendering too much too often, so you profile first, then cut work: keep state close to where it is used, split contexts, memoise (or let React Compiler do it), mark non-urgent updates as transitions, and virtualise big lists.

The notes

What you must know

  • A component re-renders when its state changes, its parent re-renders, or a context it uses changes. Props changing is not required: a parent render re-renders children unless they are memoised.
  • Profile first: React DevTools Profiler (why did this render), and React 19.2 Performance Tracks in the Chrome Performance panel (Scheduler and Components tracks).
  • Cut work: move state down, lift heavy children up as children props, split a big context into smaller ones or use a selector-based store (Zustand, Redux with useSelector).
  • React.memo skips a re-render when props are shallow-equal. It breaks if you pass a new object, array or function each render; useMemo/useCallback keep them stable.
  • React Compiler 1.0 (Oct 2025) memoises automatically at build time, so manual useMemo/useCallback matter less in compiled apps, but it cannot fix bad state structure or huge lists.
  • useTransition / startTransition mark updates as non-urgent so typing stays responsive; useDeferredValue shows the old value while the new one renders. They help INP, but do not make the work smaller.
  • Long lists: virtualise (only render visible rows). Use stable keys (not array index when items move).

The red pen

Common traps: mistake → fix

  • Mistake: "Wrap everything in useMemo and useCallback"

    Fix: memoisation has a cost and does nothing if the child is not memoised; profile first, or use React Compiler.

  • Mistake: "A component only re-renders when its props change"

    Fix: it re-renders whenever its parent re-renders unless memoised.

  • Mistake: "useTransition makes rendering faster"

    Fix: it lets urgent updates go first and can interrupt; the total work is the same.

  • Mistake: "Context is slow, never use it"

    Fix: context is fine for rarely changing values; split frequently changing values out.

Easy to hard

Questions interviewers ask, easy to hard

  1. When does a React component re-render?
  2. How do you find why a component re-renders?
  3. Optimise a React app that re-renders too often: give a step-by-step approach, not a list of tools.
  4. What does React Compiler do, and what problems does it not solve?
  5. useTransition vs useDeferredValue vs debounce for a search box: which and why?

Practise

Practise with these questions

Explain it out loud

Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.

Practise by voice

Your first interview is free

Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.

Start your free interview