Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

qahtann/react-compiler-optimized-app

Open more actions menu

Repository files navigation

⚡ React Compiler Optimized App

React TypeScript Vite React Compiler

A production-ready, performance-focused demo application showcasing React Compiler's automatic memoization capabilities. This app demonstrates senior-level frontend engineering with advanced React 19 features, TypeScript rigor, performance profiling, and real-world optimizations.

🎯 Project Goals

  • Demonstrate React Compiler Benefits: Showcase automatic memoization, reduced re-renders, and performance improvements
  • Senior-Level Engineering: Advanced React patterns, strict TypeScript, accessibility, and best practices
  • GitHub-Ready: Professional UI, comprehensive documentation, and deployment-ready setup
  • 2026 Best Practices: Modern React Compiler integration and optimization techniques

✨ Features

🚀 Performance Optimizations

  • React Compiler Integration: Automatic memoization of components and functions
  • Virtualized Lists: TanStack Virtual for efficient rendering of 10k+ items
  • Performance Metrics: Real-time render counts, FPS, and render time tracking
  • Benchmarking Tools: Compare performance with compiler enabled vs disabled

📊 Demo Pages

  • Home: Overview and feature showcase
  • List Demo: Large virtualized list with search and filtering (10k items)
  • Chart Demo: Dynamic charts with real-time updates
  • Benchmark: Performance metrics and heavy component demos

🎨 UI/UX

  • Modern Design: Clean, professional interface with shadcn/ui components
  • Dark/Light Mode: System preference detection with manual toggle
  • Responsive: Mobile-first design that works on all screen sizes
  • Accessibility: ARIA labels, semantic HTML, keyboard navigation

🛠️ Tech Stack

  • React 19+ - Latest React with experimental Compiler support
  • React Compiler - Automatic memoization via babel-plugin-react-compiler
  • TypeScript - Strict mode, no any types, full type safety
  • Vite - Fast development and optimized builds
  • Tailwind CSS v4 - Utility-first styling
  • shadcn/ui - Beautiful, accessible component library
  • TanStack Query - Powerful data fetching and caching
  • TanStack Virtual - Efficient virtual scrolling
  • Recharts - Responsive chart visualizations
  • React Router - Client-side routing
  • Vitest - Fast unit testing

📸 Screenshots

Screenshots will be added after deployment

  • Home page with feature overview
  • List demo with 10k virtualized items
  • Chart demo with real-time updates
  • Benchmark page with performance metrics

🚀 Getting Started

Prerequisites

  • Node.js 18+ and npm/yarn/pnpm
  • Git

Installation

  1. Clone the repository

    git clone https://github.com/yourusername/react-compiler-optimized-app.git
    cd react-compiler-optimized-app
  2. Install dependencies

    npm install
  3. Set up environment variables

    cp .env.example .env

    Edit .env to enable React Compiler:

    VITE_ENABLE_COMPILER=true
  4. Start development server

    npm run dev

    The app will open at http://localhost:3000

Build for Production

npm run build
npm run preview

🔧 React Compiler Setup

React Compiler is configured via environment variable and Babel plugin:

  1. Enable in .env:

    VITE_ENABLE_COMPILER=true
  2. Configuration (already set up in vite.config.ts):

    • Babel plugin: babel-plugin-react-compiler
    • Runtime module: react-compiler-runtime
    • Conditional loading based on env var
  3. Verify Compiler Status:

    • Check the badge in the header (shows "Compiler: ON/OFF")
    • Compare render counts in benchmark page

📊 Performance Benchmarks

With React Compiler Enabled

  • ✅ Automatic memoization of expensive computations
  • ✅ Reduced re-renders (visible in component render counts)
  • ✅ Improved FPS in benchmark tests
  • ✅ Lower average render times

Without React Compiler

  • Manual optimization required (useMemo, useCallback)
  • More re-renders for unchanged props
  • Higher render times for heavy components

🧪 Testing

Run tests with Vitest:

# Run tests
npm test

# Run tests with UI
npm run test:ui

📁 Project Structure

react-compiler-optimized-app/
├── src/
│   ├── app/              # App entry point
│   ├── components/
│   │   ├── ui/           # shadcn/ui components
│   │   ├── demo/         # Demo components
│   │   └── layout/       # Layout components
│   ├── hooks/            # Custom hooks
│   ├── lib/              # Utilities, types, API
│   ├── pages/            # Route pages
│   └── test/             # Test setup
├── public/               # Static assets
├── .env.example          # Environment variables template
├── vite.config.ts        # Vite configuration
├── tsconfig.json         # TypeScript configuration
└── tailwind.config.js    # Tailwind configuration

🚢 Deployment

Vercel (Recommended)

  1. Push to GitHub

    git push origin main
  2. Import to Vercel

    • Go to vercel.com
    • Import your GitHub repository
    • Add environment variable: VITE_ENABLE_COMPILER=true
    • Deploy!
  3. Environment Variables in Vercel

    • VITE_ENABLE_COMPILER: Set to true to enable React Compiler
    • VITE_API_BASE_URL: API base URL (optional)

Other Platforms

The app can be deployed to any static hosting service:

  • Netlify
  • GitHub Pages
  • Cloudflare Pages
  • AWS Amplify

🎓 Key Learnings

React Compiler Benefits

  1. Automatic Memoization: No need for manual useMemo/useCallback in most cases
  2. Reduced Re-renders: Components only re-render when props actually change
  3. Better Performance: Especially noticeable with heavy computations and large lists
  4. Cleaner Code: Less boilerplate, more readable components

Best Practices Demonstrated

  • Strict TypeScript configuration
  • Component composition and reusability
  • Performance profiling and monitoring
  • Accessibility (ARIA, semantic HTML)
  • Responsive design patterns
  • Error boundaries and loading states

🙏 Acknowledgments

📧 Contact

About

Performance-focused demo app leveraging React

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.