React Router
react-router
Declarative routing for React
Routing
react
router
route
routing
history
link
react-router
javascript
npm
frontend
Stars
57k
Weekly
33M
Open issues
239
Bundle
~15 kB
Installation
npm install react-routerCode 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>
- 33M weekly downloads. Battle tested
- MIT licensed
Considerations
- Adds roughly ~15 kB to your bundle
- Needs client-only rendering in SSR frameworks
- Not supported in React Native
- 239 open issues on GitHub