RE

React Router

react-router

Declarative routing for React

Routing
react
router
route
routing
history
link
react-router
javascript
npm
frontend
Stars
1
Weekly
0
Open issues
0
Bundle
~60 kB

Installation

npm install react-router

Code example

import { createBrowserRouter, RouterProvider, Link } from "react-router";

const router = createBrowserRouter([
  { path: "/", element: <p>Home · <Link to="/about">About</Link></p> },
  { path: "/about", element: <p>About · <Link to="/">Home</Link></p> },
]);

export function Example() {
  return <RouterProvider router={router} />;
}

Pros & cons

Pros

  • Actively maintained by Remix Software <hello@remix.run>
  • 0 weekly downloads. Battle tested
  • MIT licensed

Considerations

  • Adds roughly ~60 kB to your bundle
  • Needs client-only rendering in SSR frameworks
  • Not supported in React Native
  • 0 open issues on GitHub

FAQs

Alternatives & similar libraries