react/compiler/packages/babel-plugin-react-compiler
Jack Pope 16367ceb02
[compiler] Fix dropped ref with spread props in InlineJsxTransform (#31726)
When supporting ref as prop in
https://github.com/facebook/react/pull/31558, I missed fixing the
optimization to pass a spread-props-only props object in without an
additional object copy. In the case that we have only a ref along with a
spread, we cannot return only the spread object. This results in
dropping the ref.

In this example
```javascript
<Foo ref={ref} {...props} />
```

The bugged output is:
```javascript
{
  // ...
  props: props
}
```

With this change we now get the correct output:
```javascript
{
  // ...
  props: {ref: ref, ...props}
}
```
2024-12-10 16:11:17 -05:00
..
scripts [rcr] Update default runtimeModule to react-compiler-runtime (#31144) 2024-10-07 17:59:33 -04:00
src [compiler] Fix dropped ref with spread props in InlineJsxTransform (#31726) 2024-12-10 16:11:17 -05:00
jest.config.js
package.json [compiler] Update react deps (#31585) 2024-11-19 10:52:38 -05:00
README.md
rollup.config.js [compiler] Disable emit of .tsbuildinfo (#31459) 2024-11-14 15:43:36 -05:00
tsconfig.json

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