Files
react/compiler/packages/babel-plugin-react-compiler
Joe Savona 6d75e612fe compiler: Fixtures to show challenge with setters
I quickly experimented with enabling support for get/set syntax. This confirmed my suspicion that these won't be safe without additional work. The "set" fixture example shows how we assume PropertyStore is only a Store effect on the object, but with a setter it needs to be modeled as an arbitrary mutation.

If we were to support getters and setters I think we'd need to:
* Support `this` syntax (maybe limited to just within object methods)
* Enforce that getters cannot mutate any free variables, cannot mutate `this`
* Enforce that setters cannot mutate any free variables (but allow mutating `this`).

In other words, enforce that you're using getters/setters in a reasonable way that matches our modeling (get is a read, set is a store to the object).

[ghstack-poisoned]
2024-05-25 23:19:33 +01:00
..
2024-05-13 14:10:16 -07:00
2024-05-02 14:12:33 -07:00
2024-05-02 14:12:33 -07:00
2024-05-02 14:12:33 -07:00
2024-05-02 14:12:33 -07:00
2024-05-02 14:12:33 -07:00

babel-plugin-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.

This package contains the React Compiler Babel plugin use in projects that make use of Babel. You can find instructions for using this plugin here: https://react.dev/learn/react-compiler