React Router Local Development Guide
React Router v7 integrates the original Remix capabilities, supporting SPA, SSR, and full-stack routing, with localhost:5173 as the default for local development.
React Router (from v7) integrates the full-stack capabilities of the original Remix framework: filesystem routing, data loading (loader/action), server-side rendering, and streaming. It is suitable for React applications that require SEO and server logic.
Quick Start
Create a project using the official template:
npx create-react-router@latest my-app
cd my-app
npm install
npm run devDefault localhost Access
| Purpose | Address |
|---|---|
| Development Server | http://localhost:5173 |
| Local Production Run | Based on react-router-serve configuration, commonly on port 3000 |
Specific ports are determined by terminal output; they can be modified in Vite/server configuration.
Relationship with Remix
- Remix has been merged into React Router v7, with new documentation and package name unified as React Router
- Existing Remix projects can be gradually migrated; concepts such as routing, loader, and action remain consistent
- Deployment targets include Node.js servers, Cloudflare Workers, Netlify, etc.
Common Commands
| Command | Description |
|---|---|
npm run dev | Development mode |
npm run build | Build client and server artifacts |
npm run start | Run production build (full-stack mode) |
Summary
React Router is the full-stack routing solution for the React ecosystem, with local development typically starting at http://localhost:5173. For pure SPA needs, client-side routing can be used alone; for SSR, the framework’s default full-stack mode should be utilized.