Rasengan Logo
Rasengan Logo
  • Docs
  • Blog
  • Showcase
Using stable versionv1.2.1
Documentation
Packages
Templates
Rasengan UI Kit
Using stable versionv1.2.1
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:

npm install -D babel-plugin-react-compiler

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

rasengan.config.js
import { 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
import { 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
export 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

Discover Plus Ultra ✨

A stunning and well crafted Portfolio website to showcase your work in a nice way.

Rasengan Logo
Rasengan Logo

Resources

  • Docs
  • Packages
  • Blog
  • Showcase
  • Support us

Products

  • Rasengan UI
  • Rasengan Hub
  • Chidori
  • Nindo
  • Chunin

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.