react-compiler-runtime is a foundational library that provides the necessary primitives and infrastructure for the experimental React Compiler to operate effectively at runtime. It underpins the compiler's ability to automatically memoize components and hooks, thereby optimizing rendering performance without manual `useMemo` or `useCallback` declarations. The package itself is largely internal, meant to be consumed by the compiled output of the React Compiler rather than directly imported by application developers. As of version 1.0.0, its release cadence is tightly coupled with the development and release cycles of the broader React ecosystem, particularly the React Compiler and React core library (currently React 19 is under active development). Its key differentiator is enabling a future where React applications achieve optimal performance with significantly reduced boilerplate, shifting the responsibility of memoization from the developer to the build toolchain.
npm install react-compiler-runtimeVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates a React component with a manually memoized calculation, illustrating the type of optimization the React Compiler and its runtime (react-compiler-runtime) aim to automate.
Avoid direct imports or reliance on `react-compiler-runtime`'s internal symbols in application code. Focus on adhering to React's Rules of Hooks and letting the `babel-plugin-react-compiler` handle the optimization.
Monitor official React Compiler documentation and release notes. Implement thorough testing for applications or libraries using the compiler to catch regressions.
Upgrade or downgrade your `react` and `react-dom` packages to satisfy the peer dependency range, e.g., `npm install react@latest react-dom@latest`.
Always use the latest stable version of `eslint-plugin-react-hooks` and `eslint-plugin-react-compiler` to ensure you have the most up-to-date linting rules and compiler integration.
`npm install react-compiler-runtime` or `yarn add react-compiler-runtime`. For libraries targeting React < 19, ensure it's a direct dependency and included in the final bundle.
Verify your React Compiler setup, ensuring proper transpilation and React version compatibility in your Babel/Vite configuration. Check your `react` and `react-dom` versions. Ensure your code adheres to React's Rules of Hooks.
Upgrade or downgrade your `react` and `react-dom` packages to match the required range, e.g., `npm install react@latest react-dom@latest` or `npm install react@18 react-dom@18`.