Skip to content

React Router

A routing library for React apps that maps URLs to screens and data.

Stars
56.6k
Forks
11k
Licence
MIT
Language
TypeScript
Last update
6 days ago
Type
Library

What it is

React Router handles navigation in React apps: it decides which page or component to show based on the URL, and can load data for that page. It can be used as a full framework with its own project setup, or as a smaller library that you wire into your own architecture. The README describes it as a multi-strategy router, with modes named Framework, Data, and Declarative.

  • Map URL paths to React components so different pages render for different addresses
  • Use the Framework mode to create a full project with the create-react-router package
  • Add the core react-router package to an existing React app for declarative routing

Great for

  • React developers building single-page or multi-page web apps
  • Teams that want a choice between a full framework and a lighter routing library
  • Developers who want file-system based routes via the @react-router/fs-routes package
  • Projects that deploy to Node.js, Express, Cloudflare, or Architect, since the README lists adapters for each

Not ideal for

  • People who are not writing React code, since it is a React-specific library
  • Beginners with no React experience, who should learn React basics first
  • Projects that need a different frontend framework such as Vue or Svelte
Step-by-step guide: how to use React RouterInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: Node.js · npm or another JavaScript package manager

    Create a new framework project

    npx create-react-router@latest
  2. 2

    Run it

    • Run the create command to generate a project
    • Follow the Getting Started docs at reactrouter.com/start/modes to choose a mode
    • Start the dev server as described in the generated project's instructions
  3. 3

    Get the most out of it

    • Read the mode guide at reactrouter.com/start/modes to pick Framework, Data, or Declarative
    • Use @react-router/fs-routes if you want routes defined by file structure
    • Pick a deployment adapter such as @react-router/node, @react-router/express, or @react-router/cloudflare that matches your hosting
    • Check the changelog on GitHub when upgrading between major versions

Downloads

Strengths

  • Widely used, with 56,629 stars and an MIT license
  • Offers several modes so you can adopt as much or as little as you need
  • Actively maintained, with a recent push and published npm releases

Trade-offs

  • The README is truncated and gives few details on specific APIs, so the full scope is unclear from it alone
  • Major versions change significantly, and the README links to separate upgrade guides for v5, v6, and v7
  • Choosing between Framework, Data, and Declarative modes adds up-front decisions for new users

How it compares

ProjectStarsTypeLevelUpdatedBest for
react-router (this)56.6kLibraryintermediate6 days agoReact developers building single-page or multi-page web apps
router15.3kLibraryintermediate4 days agoReact developers who want type-checked routes and URL parameters
next.js143kFrameworkintermediate4 days agoDevelopers already comfortable with React who want a full framework around it

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.