#01 1. How the React Compiler Works: From AST Analysis to Fine-Grained Auto-Memoization
React 19 introduces the React Compiler (formerly Forget), and it changes things fundamentally. During the Babel / SWC compile step it runs a whole-component control flow graph analysis of the dependency relationships and automatically inserts local cache slots wherever a value is computed:
You no longer have to hand-maintain dependency arrays:
// Previously this needed a manual memo
const memoizedValue = useMemo(() => computeHeavy(a, b), [a, b]);
// Now the compiler injects an equivalent $[] cache array into the build output