Files
react/compiler
Jorge Cabiedes Acosta 15ea89b753 [Compiler] Avoid capturing global setStates for no-derived-computations lint
Summary:
This only matters when enableTreatSetIdentifiersAsStateSetters=true

This pattern is still bad. But Right now the validation can only recommend to move stuff to "calculate in render"

A global setState should not be moved to render, not even conditionally and you can't remove state without crossing Component boundaries, which makes this a different kind of fix.

So while we are only suggesting "calculate in render" as a fix we should disallow the lint from throwing in this case IMO

Test Plan:
Added a fixture
2025-11-13 22:53:35 -08:00
..
2025-03-13 11:45:26 -04:00

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.