Skip to main content

Installation

Install React Router based on which mode you want to use. Each mode has different dependencies and setup requirements.

Framework Mode Installation

Framework Mode provides the full-stack experience with Vite integration, automatic type generation, and SSR support.

Install Dependencies

Configure Vite

Update your vite.config.ts:
vite.config.ts

Add Scripts

Update your package.json:
package.json
Framework Mode requires Node.js 20 or higher.

Server Adapters

For Framework Mode with SSR, choose a server adapter based on your deployment target:

Node.js

For Node.js environments like Express or standalone servers

Cloudflare

For Cloudflare Workers and Pages

Express

For Express.js integration

Optional Packages

File-based Routing

Use flatRoutes() for automatic route generation from your file system:
app/routes.ts

Verify Installation

1

Check package.json

Verify that react-router appears in your dependencies with the correct version.
2

Run type check

For Framework Mode, run npm run typecheck to generate types and verify setup.
3

Start dev server

Run your dev command (npm run dev) to ensure everything is configured correctly.

Next Steps

Quick Start Guide

Build your first React Router application