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 dev

Default localhost Access

PurposeAddress
Development Serverhttp://localhost:5173
Local Production RunBased 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

CommandDescription
npm run devDevelopment mode
npm run buildBuild client and server artifacts
npm run startRun 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.

访客计数:------ Best viewed in Netscape Navigator · 800×600 © LocalHost Run