The original React components and logic written by developers. React Compiler Analyzes and automatically optimizes the source code during build. Optimized JS The resulting high-performance, production-ready JavaScript code. Key facts • Formerly called React Forget • Runs at build time — zero additional runtime cost • Ships as a Babel/SWC plugin • Does fine-grained reactivity analysis — not blind wrapping
of all values & dependencies Analyze Reactivity Tag values as reactive (props/state) or static Group Blocks Bundle related computations into one memoization unit Emit Code Output readable React with cache checks baked in One memoization block — not three separate useMemo calls. That's more efficient than anything we write by hand.
— compiler off 47 components re-rendered Per keystroke in search Every product card, the cart, the header — all re-render on every keystroke. 🟢 After — compiler on 5 components re-rendered Per keystroke in search Cards that don't depend on search state? Skipped. Automatically.
state Push to arrays → stale renders. The compiler assumes Rules of React. 2 Architectural bottlenecks Can't virtualize, can't reduce component count, can't offload to a Web Worker. Those decisions are still yours. 3 Rule-breaking 3rd-party libs Mutating props, relying on referential inequality — test your critical paths. Fix first: Run eslint-plugin-react-compiler before enabling. It flags exactly what the compiler can't safely optimize.
it flags — they're probably bugs anyway. Annotation Mode Add "use memo" to 3–5 of your heaviest components. Benchmark Profile before & after. Put the numbers in your PR description. Expand Gradually Switch to full compilation. Keep ESLint in CI to protect the gains.
The compiler computes dependencies statically and consistently. 2 One flag in Next.js Adopt gradually with annotation mode. Measure as you go. 3 Benchmark with three tools React Profiler → Chrome DevTools → Lighthouse. In that order. 4 Rules of React still apply Fix violations first — you'll be better off either way. "The best optimization is the one you don't have to think about."