Skip to content

profusion/react-compiler-poc

Repository files navigation

⚡ React Compiler Proof Of Concept

This small project was created to experiment with the new React Compiler and observe how it optimizes rendering behavior in functional components — without using React.memo, useCallback, or useMemo manually.


🧠 Objective

The goal is to test how React Compiler automatically handles component re-rendering, ensuring that:

  • Parent components do not re-render when a child updates its state.
  • Each component manages its own state internally.
  • The app remains performant and predictable even without manual memoization.

🧩 Project Structure


App
├─ TextInputCard   → handles local text input
├─ CounterCard     → handles a local counter
└─ ItemsListCard   → manages a list of items

Each child component logs its own render to the console (e.g., Render Counter) so you can track when each one re-renders.


🚀 Running the Project

  1. Install dependencies:

    npm install
  2. Run the app in development mode:

    npm run dev
  3. Open your browser and inspect the console — you’ll see logs showing when each component renders.

🧩 Notes on React Compiler

  • No need for React.memo, useCallback, or useMemo.
  • Each component’s render behavior is optimized automatically.
  • The test demonstrates isolation of state and component boundaries, which the compiler uses to skip unnecessary renders.
  • To enable/disable React Compiler, just add/remove the 'babel-plugin-react-compiler' on babel plugins, on vite.config.ts

📚 References

About

A brief Proof of Concept about the brand new React Compiler v1.0

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published