Skip to main content

Framework Mode

Framework Mode is the full-featured way to use React Router. It wraps Data Mode with a Vite plugin to add type-safe routing, intelligent code splitting, and flexible rendering strategies (SPA, SSR, SSG).

Quick Start

What You Get

Framework Mode provides:
  • Type Safety: Auto-generated types for params, loader data, and actions
  • Code Splitting: Automatic route-based code splitting
  • SSR/SPA/SSG: Choose your rendering strategy per route
  • File-based or Config-based Routing: Use what works for your team
  • Optimized Builds: Production-ready bundling with Vite
  • Development Server: Fast HMR and instant feedback

Project Structure

A typical Framework Mode project looks like this:

Configuring Routes

Route Modules

Route modules define behavior for each route using exports:

Type Safety

Framework Mode automatically generates types for your routes:
Types are generated automatically on file changes during development. No manual type definitions needed!

Nested Routes and Layouts

Data Loading Strategies

Rendering Strategies

Configure in react-router.config.ts:

Vite Plugin Setup

The plugin is configured in vite.config.ts:

Next Steps

Framework Mode gives you the full power of React Router with the best developer experience.