mirror of
https://github.com/facebook/react.git
synced 2026-02-23 20:23:02 +00:00
Rewrites ValidateNoRefAccessInRender to use a simpler single-pass algorithm that only validates ref mutations (reads are now handled separately by ValidateNoImpureValuesInRender). The new approach: - Tracks refs and ref values through the function - Identifies functions that mutate refs (directly or transitively) - Only errors when ref-mutating functions are called at the top level - Supports null-guard exception: mutations inside `if (ref.current == null)` are allowed for the initialization pattern This reduces ~700 lines of complex fixpoint iteration to ~400 lines of straightforward forward data-flow analysis.
React Compiler
React Compiler is a compiler that optimizes React applications, ensuring that only the minimal parts of components and hooks will re-render when state changes. The compiler also validates that components and hooks follow the Rules of React.
More information about the design and architecture of the compiler are covered in the Design Goals.
More information about developing the compiler itself is covered in the Development Guide.