Skip to the page

Performance · senior

React Compiler: automatic memoization

React Compiler 1.0 (October 2025) is a build-time tool that adds fine-grained memoization to components and hooks automatically, so new code rarely needs manual useMemo/useCallback; it only works on code that follows the Rules of React.

The notes

What you must know

  • Status (Nov 2026): stable since v1.0 (7 Oct 2025). Works with React 17+ (for 17/18 set a target and add react-compiler-runtime).
  • It runs at build time as babel-plugin-react-compiler; Next.js has stable reactCompiler: true (off by default, Babel-based, slower builds) and an experimental Rust version (experimental.turbopackRustReactCompiler, 16.3+). Expo SDK 54+ enables it by default. Vite/Next templates offer it as an option.
  • It memoizes values, JSX and callbacks granularly, even conditionally and after early returns, which manual memoization cannot do.
  • It skips (bails out of) code that breaks the Rules of React: mutating props/state during render, reading refs during render, conditional hooks.
  • Compiler-powered lint rules ship in eslint-plugin-react-hooks (recommended preset): for example set-state-in-render, set-state-in-effect, refs. The linter does not require the compiler.
  • Official advice: new code relies on the compiler and uses useMemo/useCallback only for precise control (for example effect deps). Existing code: leave existing memoization in place or test carefully before removing it, because removing it can change output and when effects fire.
  • Rollout: fix lint violations first; adopt by directory (Babel overrides), annotation mode ("use memo"), or runtime gating; use "use no memo" on a problem component temporarily; pin the exact version if test coverage is thin.
  • Meta reported up to 12% faster loads/navigations and some interactions 2.5x faster (Quest Store). It does not fix context re-renders or slow non-React code.

The red pen

Common traps: mistake → fix

  • Mistake: "The compiler makes re-renders impossible"

    Fix: it reduces unnecessary work; state changes still re-render.

  • Mistake: "Remove all useMemo/useCallback in one PR after enabling it"

    Fix: the React team advises leaving them or testing carefully.

  • Mistake: "It is still experimental / a beta"

    Fix: 1.0 is stable; only the Rust version in Next.js is experimental.

  • Mistake: "Interviewers no longer ask memo questions"

    Fix: Indian loops still ask the classic useMemo vs useCallback; answer both layers.

Easy to hard

Questions interviewers ask, easy to hard

  1. Does the React Compiler mean we can stop writing useMemo and useCallback?
  2. What does it memoize that manual memo cannot?
  3. What code makes it bail out?
  4. Would you remove the existing manual memoization? Why not?
  5. You are the lead: plan the rollout for a 400-component app with flaky tests.

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