Skip to content

React 19 comes with an experimental compiler that optimizes application code to automatically memoize code. Read the official React Compiler documentation for more information.

For Nx projects using Babel and the @nx/react/babel preset, install the babel-plugin-react-compiler package and enable it with the reactCompiler option.

{
"presets": [
[
"@nx/react/babel",
{
"runtime": "automatic",
"reactCompiler": true
}
]
],
"plugins": []
}

You can also pass an object to set compiler options.

{
"presets": [
[
"@nx/react/babel",
{
"runtime": "automatic",
"reactCompiler": {
"compilationMode": "annotation"
}
}
]
],
"plugins": []
}

Check the React Compiler usage docs for all support setups, such as Vite, Remix, etc.