Rasengan Logo
Rasengan Logo
  • Docs
  • Blog
  • Showcase
  • Support us
Using stable versionv1.2.0
Documentation
Packages
Templates
Rasengan UI Kit
Using stable versionv1.2.0
Documentation
Packages
Templates
Rasengan UI Kit

CORE CONCEPTS

React Compiler

Rasengan.js includes support for the React Compiler, a tool designed to improve performance by automatically optimizing component rendering. This reduces the need for manual memoization using useMemo and useCallback.

How It Works

The React Compiler runs through a Babel plugin.

To use it, install the babel-plugin-react-compiler:

bashnpm install -D babel-plugin-react-compiler

Then, add reactCompiler option in rasengan.config.js via the sageMode option:

rasengan.config.js
jsimport { defineConfig } from 'rasengan'; import { rasengan } from 'rasengan/plugin'; export default defineConfig({ sageMode: { reactCompiler: true }, vite: { plugins: [rasengan()], }, });

Annotations

You can configure the compiler to run in "opt-in" mode as follows:

rasengan.config.js
jsimport { defineConfig } from 'rasengan'; import { rasengan } from 'rasengan/plugin'; export default defineConfig({ sageMode: { reactCompiler: { compilationMode: 'annotation'; } }, vite: { plugins: [rasengan()], }, });

Then, you can annotate specific components or hooks with the "use memo" directive from React to opt-in:

app/_routes/index.page.tsx
tsexport default function Page() { 'use memo' // ... }

Note: You can also use the "use no memo" directive from React for the opposite effect, to opt-out a component or hook.

Static Assets
Typescript

ON THIS PAGE

How It Works
Annotations
Rasengan Logo
Rasengan Logo

Resources

  • Docs
  • Packages
  • Blog
  • Showcase
  • Support us

Community

  • Github
  • X (Twitter)

Subscribe to the Newsletter

Stay informed to the news about rasengan.js including new releases, events, etc...

© 2024-2026 Rasengan Labs, All rights reserved.