You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/learn/react-compiler.md
+25-29
Original file line number
Diff line number
Diff line change
@@ -192,61 +192,63 @@ export default function App() {
192
192
193
193
When you have more confidence with rolling out the compiler, you can expand coverage to other directories as well and slowly roll it out to your whole app.
194
194
195
-
#### New projects {/*new-projects*/}
196
-
197
-
If you're starting a new project, you can enable the compiler on your entire codebase, which is the default behavior.
195
+
### Using React Compiler with React 17 or 18 {/*using-react-compiler-with-react-17-or-18*/}
198
196
199
-
## Usage {/*installation*/}
200
-
201
-
### Babel {/*usage-with-babel*/}
197
+
React Compiler works best with React 19 RC. If you are unable to upgrade, you can install the extra `react-compiler-runtime` package which will allow the compiled code to run on versions prior to 19. However, note that the minimum supported version is 17.
`babel-plugin-react-compiler` should run first before other Babel plugins as the compiler requires the input source information for sound analysis.
220
+
#### New projects {/*new-projects*/}
226
221
227
-
React Compiler works best with React 19 RC. If you are unable to upgrade, you can install the extra `react-compiler-runtime` package which will allow the compiled code to run on versions prior to 19. However, note that the minimum supported version is 17.
222
+
If you're starting a new project, you can enable the compiler on your entire codebase, which is the default behavior.
['babel-plugin-react-compiler', ReactCompilerConfig], // must run first!
244
+
// ...
245
245
],
246
246
};
247
247
};
248
248
```
249
249
250
+
`babel-plugin-react-compiler` should run first before other Babel plugins as the compiler requires the input source information for sound analysis.
251
+
250
252
### Vite {/*usage-with-vite*/}
251
253
252
254
If you use Vite, you can add the plugin to vite-plugin-react:
@@ -392,12 +394,6 @@ To report issues, please first create a minimal repro on the [React Compiler Pla
392
394
393
395
You can also provide feedback in the React Compiler Working Group by applying to be a member. Please see [the README for more details on joining](https://github.com/reactwg/react-compiler).
394
396
395
-
### `(0 , _c) is not a function` error {/*0--_c-is-not-a-function-error*/}
396
-
397
-
This occurs if you are not using React 19 RC and up. To fix this, [upgrade your app to React 19 RC](https://react.dev/blog/2024/04/25/react-19-upgrade-guide) first.
398
-
399
-
If you are unable to upgrade to React 19, you may try a userspace implementation of the cache function as described in the [Working Group](https://github.com/reactwg/react-compiler/discussions/6). However, please note that this is not recommended and you should upgrade to React 19 when possible.
400
-
401
397
### How do I know my components have been optimized? {/*how-do-i-know-my-components-have-been-optimized*/}
402
398
403
399
[React Devtools](/learn/react-developer-tools) (v5.0+) has built-in support for React Compiler and will display a "Memo ✨" badge next to components that have been optimized by the compiler.
0 commit comments