# React routing libraries

React routing libraries match the browser URL to the components a React app renders. A router maps each path to a route component and can load that route's data before it renders. These libraries let single-page apps and server-rendered sites keep navigation in sync with browser history.

## Popularity

| Library | Monthly downloads | Stars | Last release | License |
| --- | --- | --- | --- | --- |
| [next](#next-js) | 362.1M | 143.7K | Nov 2026 | MIT |
| [react-router](#react-router) | 294.3M | 56.6K | Oct 2026 | MIT |
| [@tanstack/react-router](#tanstack-router) | 95.0M | 15.3K | Oct 2026 | MIT |
| [wouter](#wouter) | 10.7M | 7.9K | Sep 2026 | Unlicense |
| [Remix](#remix-run-react) | 3.2M | 33.5K | Jun 2026 | MIT |
| [@reach/router](#reach-router) | 1.8M | 6.8K | Jun 2020 | MIT |
| [gatsby](#gatsby) | 1.2M | 55.9K | Feb 2026 | MIT |
| [react-router5](#react-routerfive) | 42.8K | 1.7K | Mar 2020 | MIT |

Downloads: npm, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

[next](#next-js) has the most monthly downloads in this comparison, at 362.1M, a count that covers every Next.js app.

## Capabilities

| Library | File-system route generation | Route-owned data loading |
| --- | --- | --- |
| [next](#next-js) | Yes | Yes |
| [react-router](#react-router) | Via plugin | Yes |
| [@tanstack/react-router](#tanstack-router) | Via plugin | Yes |
| [wouter](#wouter) | No | No |
| [Remix](#remix-run-react) | Yes | Yes |
| [@reach/router](#reach-router) | No | No |
| [gatsby](#gatsby) | Yes | Yes |
| [react-router5](#react-routerfive) | No | No |

## Libraries

### next

[GitHub](https://github.com/vercel/next.js) · [npm](https://www.npmjs.com/package/next) · [Docs](https://nextjs.org)

Defines React application routes through files, shared layouts, and server-rendered page components.

- Downloads / mo: 362.1M
- Stars: 143.7K
- Last release: 16.4.6
- License: MIT
- Capabilities: [From the next docs](https://nextjs.org)

**Strengths**

- **Preserves layouts between pages.** Keep shared layouts interactive while navigating between their pages.
- **Fetches data in server components.** Load page data directly through fetch or a database client.

**Watch out for**

- **Static search hooks need Suspense.** Wrap useSearchParams in Suspense when the page is statically rendered.
- **Refresh preserves server-side cached data.** Use revalidatePath or revalidateTag when cached server data must change.

```sh
npx create-next-app@16.4.6 routing-demo --yes
```

**umami-software/umami** (40.2K stars)

[umami-software/umami](https://github.com/umami-software/umami) 

```tsx
export function useNavigation() {
  const router = useRouter();
  const pathname = usePathname();
  const searchParams = useSearchParams();
  const [, teamId] = pathname.match(/\/teams\/([a-f0-9-]+)/) || [];
  const [, websiteId] = pathname.match(/\/websites\/([a-f0-9-]+)/) || [];
  const [, linkId] = pathname.match(/\/links\/([a-f0-9-]+)/) || [];
  const [, pixelId] = pathname.match(/\/pixels\/([a-f0-9-]+)/) || [];
  const [, boardId] = pathname.match(/\/boards\/([a-f0-9-]+)/) || [];
  const searchParamsString = searchParams.toString();
  const queryParams = useMemo(() => Object.fromEntries(searchParams), [searchParamsString]);

  const updateParams = useCallback(
    (params?: Record<string, string | number>) => {
      return buildPath(pathname, { ...queryParams, ...params });
    },
    [pathname, queryParams],
  );

  const replaceParams = useCallback(
    (params?: Record<string, string | number>) => {
      return buildPath(pathname, params);
    },
    [pathname],
  );

  const renderUrl = useCallback(
    (path: string, params?: Record<string, string | number> | false) => {
      return buildPath(
        teamId ? `/teams/${teamId}${path}` : path,
        params === false ? {} : { ...queryParams, ...params },
      );
    },
    [teamId, queryParams],
  );

  return {
    router,
    pathname,
    searchParams,
    query: queryParams,
    teamId,
    websiteId,
    linkId,
    pixelId,
    boardId,
    updateParams,
    replaceParams,
    renderUrl,
  };
}
```

[src/components/hooks/useNavigation.ts](https://github.com/umami-software/umami/blob/b18d5144dfe7342edeeca6f61d13ba3baabed9ad/src/components/hooks/useNavigation.ts#L5-L55) · [More projects using next →](https://dashboard.exa.ai/playground/search?q=React%20projects%20using%20next%20for%20stable%20navigation%20callbacks%2C%20active%20sidebar%20links%20and%20URL%20query-state%20helpers&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```tsx
import Link from 'next/link';

export default function Page() {
  return <Link href='/about'>About</Link>;
}

```

From [linking-and-navigating.md](https://nextjs.org/docs/app/getting-started/linking-and-navigating)

### react-router

[GitHub](https://github.com/remix-run/react-router) · [npm](https://www.npmjs.com/package/react-router) · [Docs](https://github.com/remix-run/react-router#readme)

Matches URLs to React interfaces, with optional data routing and a full framework mode.

- Downloads / mo: 294.3M
- Stars: 56.6K
- Last release: 8.5.1
- License: MIT
- Capabilities: [From the react-router docs](https://github.com/remix-run/react-router#readme)

**Strengths**

- **Chooses routing features by mode.** Start with declarative routing or add data loading and framework tooling.
- **Loads data alongside route navigation.** Use loaders, actions, and pending states in Data Mode.

**Watch out for**

- **Declarative mode excludes data APIs.** Choose Data or Framework Mode for loaders, actions, and fetchers.
- **Parent authentication leaves child gaps.** Protect each loader and action, or use appropriate server middleware.

```sh
npm install react-router react@^19.2.7 react-dom@^19.2.7 @types/react@^19.2.0 @types/react-dom@^19.2.0
```

**mui/material-ui** (99.4K stars)

[mui/material-ui](https://github.com/mui/material-ui) 

```tsx
export function Layout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en" suppressHydrationWarning>
      <head>
        <meta charSet="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <Meta />
        <Links />
      </head>
      <body>
        {children}
        <ScrollRestoration />
        <Scripts />
      </body>
    </html>
  );
}
```

[examples/material-ui-react-router-ts/app/root.tsx](https://github.com/mui/material-ui/blob/a152f7a517b91706e4aeddf650ca3a9900bb2a20/examples/material-ui-react-router-ts/app/root.tsx) · [More projects using react-router →](https://dashboard.exa.ai/playground/search?q=React%20projects%20using%20react-router%20for%20stable%20navigation%20callbacks%2C%20active%20sidebar%20links%20and%20URL%20query-state%20helpers&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```tsx
import { createRoot } from 'react-dom/client';
import { BrowserRouter, Routes, Route } from 'react-router';

createRoot(document.getElementById('root')!).render(
  <BrowserRouter>
    <Routes><Route path='/' element={<h1>Home</h1>} /></Routes>
  </BrowserRouter>
);

```

From [installation.md](https://reactrouter.com/start/declarative/installation)

### @tanstack/react-router

[GitHub](https://github.com/TanStack/router) · [npm](https://www.npmjs.com/package/@tanstack/react-router) · [Docs](https://tanstack.com/router)

Provides typed React navigation, nested route trees, and cached per-route data loaders.

- Downloads / mo: 95.0M
- Stars: 15.3K
- Last release: 1.170.46
- License: MIT
- Capabilities: [From the @tanstack/react-router docs](https://tanstack.com/router)

**Strengths**

- **Infers types throughout routing.** Carry path, search, and context types through navigation and route hooks.
- **Caches and preloads route data.** Reuse route-loader data with built-in stale-while-revalidate caching.

**Watch out for**

- **Loader caches stay route-specific.** Add a shared data cache when routes need deduplicated records.
- **Server navigation calls do nothing.** Use the redirect API to redirect a server-rendered request.

```sh
npm install @tanstack/react-router react react-dom
```

**Quickstart**

```tsx
import { createRoot } from 'react-dom/client';
import { createRootRoute, createRoute, createRouter, Outlet, RouterProvider } from '@tanstack/react-router';

const rootRoute = createRootRoute({ component: () => <Outlet /> });
const homeRoute = createRoute({ getParentRoute: () => rootRoute, path: '/', component: () => <h1>Home</h1> });
const router = createRouter({ routeTree: rootRoute.addChildren([homeRoute]) });
createRoot(document.getElementById('root')!).render(<RouterProvider router={router} />);

```

From [main.tsx](https://tanstack.com/router/latest/docs/framework/react/routing/code-based-routing) · [Find projects using @tanstack/react-router →](https://dashboard.exa.ai/playground/search?q=React%20projects%20using%20%40tanstack/react-router%20for%20stable%20navigation%20callbacks%2C%20active%20sidebar%20links%20and%20URL%20query-state%20helpers&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

### wouter

[GitHub](https://github.com/molefrog/wouter) · [npm](https://www.npmjs.com/package/wouter) · [Docs](https://github.com/molefrog/wouter#readme)

Provides hook-based location control and component-based routing for React and Preact applications.

- Downloads / mo: 10.7M
- Stars: 7.9K
- Last release: 3.13.0
- License: Unlicense
- Capabilities: [From the wouter docs](https://github.com/molefrog/wouter#readme)

**Strengths**

- **Uses hooks or route components.** Choose direct location control or component-based matching for the interface.
- **Nests routes with relative locations.** Enable nest to give child routes locations relative to their parent.

**Watch out for**

- **Reads the nearest route parameters.** Read useParams within the route that owns the needed parameter.
- **Server rendering needs explicit location.** Wrap the server-rendered application in Router with the request path.

```sh
npm install wouter react react-dom
```

**the-via/app** (1.7K stars)

[the-via/app](https://github.com/the-via/app) 

```tsx
() => {
  const hasHIDSupport = 'hid' in navigator || OVERRIDE_HID_CHECK;

  const renderMode = useAppSelector(getRenderMode);
  const showConsoleTab = useAppSelector(getShowConsoleTab);
  const [location] = useLocation();
  const RouteComponents = useMemo(
    () =>
      PANES.filter((pane) => pane.key !== 'console').map((pane) => {
        return (
          <Route component={pane.component} key={pane.key} path={pane.path} />
        );
      }),
    [],
  );

  const CanvasRouter = renderMode === '2D' ? CanvasRouter2D : CanvasRouter3D;
  const testContextState = useState({clearTestKeys: () => {}});
  return (
    <>
        <TestContext.Provider value={testContextState}>
          <GlobalStyle />
          {hasHIDSupport && <UnconnectedGlobalMenu />}
          <CanvasRouter />

          <Home hasHIDSupport={hasHIDSupport}>
            {RouteComponents}
            {showConsoleTab && (
              <PersistentPane $active={location === '/console'}>
                <HIDConsole isActive={location === '/console'} />
              </PersistentPane>
            )}
          </Home>
        </TestContext.Provider>
    </>
  );
}
```

[src/Routes.tsx](https://github.com/the-via/app/blob/935106a990af39bdd1ade881c02366eac486240d/src/Routes.tsx) · [More projects using wouter →](https://dashboard.exa.ai/playground/search?q=React%20projects%20using%20wouter%20for%20stable%20navigation%20callbacks%2C%20active%20sidebar%20links%20and%20URL%20query-state%20helpers&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```tsx
import { useLocation } from 'wouter';

export default function Location() {
  const [location] = useLocation();
  return <p>{location}</p>;
}

```

From [README.md](https://cdn.jsdelivr.net/npm/wouter@3.13.0/README.md)

### Remix

[GitHub](https://github.com/remix-run/remix) · [npm](https://www.npmjs.com/package/@remix-run/react) · [Docs](https://github.com/remix-run/remix#readme)

Provides React DOM bindings for Remix.

- Downloads / mo: 3.2M
- Stars: 33.5K
- Last release: 2.17.5
- License: MIT
- Capabilities: [From the Remix docs](https://github.com/remix-run/remix#readme)

```sh
npx create-remix@2.17.5 routing-demo
```

**remix-run/indie-stack** (1.1K stars)

[remix-run/indie-stack](https://github.com/remix-run/indie-stack) 

```tsx
export default function NoteDetailsPage() {
  const data = useLoaderData<typeof loader>();

  return (
    <div>
      <h3 className="text-2xl font-bold">{data.note.title}</h3>
      <p className="py-6">{data.note.body}</p>
      <hr className="my-4" />
      <Form method="post">
        <button
          type="submit"
          className="rounded bg-blue-500 px-4 py-2 text-white hover:bg-blue-600 focus:bg-blue-400"
        >
          Delete
        </button>
      </Form>
    </div>
  );
}
```

[app/routes/notes.$noteId.tsx](https://github.com/remix-run/indie-stack/blob/56abb93bf81f635b574d9ca23eed05602699458a/app/routes/notes.$noteId.tsx#L34-L52) · [More projects using Remix →](https://dashboard.exa.ai/playground/search?q=%40remix-run/react%20GitHub%20projects)

**Quickstart**

```tsx
import { Link } from '@remix-run/react';

export default function Index() {
  return <Link to='/about'>About</Link>;
}

```

From [README.md](https://v2.remix.run/docs/components/link/)

### @reach/router

[GitHub](https://github.com/reach/router) · [npm](https://www.npmjs.com/package/@reach/router) · [Docs](https://github.com/reach/router#readme)

Provides routing for React.

- Downloads / mo: 1.8M
- Stars: 6.8K
- Last release: 1.3.4
- License: MIT
- Capabilities: [From the @reach/router docs](https://github.com/reach/router#readme)

```sh
npm install @reach/router react@16 react-dom@16
```

**thanos-io/thanos** (14.3K stars)

[thanos-io/thanos](https://github.com/thanos-io/thanos) 

```tsx
const App: FC<PathPrefixProps & ThanosComponentProps> = ({ pathPrefix, thanosComponent }) => {
  const [userTheme, setUserTheme] = useLocalStorage<themeSetting>(themeLocalStorageKey, 'auto');
  const browserHasThemes = useMedia('(prefers-color-scheme)');
  const browserWantsDarkTheme = useMedia('(prefers-color-scheme: dark)');

  let theme: themeName;
  if (userTheme !== 'auto') {
    theme = userTheme;
  } else {
    theme = browserHasThemes ? (browserWantsDarkTheme ? 'dark' : 'light') : 'light';
  }

  return (
    <ThemeContext.Provider
      value={{ theme: theme, userPreference: userTheme, setTheme: (t: themeSetting) => setUserTheme(t) }}
    >
      <Theme />
      <ErrorBoundary>
        <Navigation
          pathPrefix={pathPrefix}
          thanosComponent={thanosComponent}
          defaultRoute={defaultRouteConfig[thanosComponent]}
        />
        <Container fluid style={{ paddingTop: 70 }}>
          <QueryParamProvider reachHistory={globalHistory}>
            <Router basepath={`${pathPrefix}`}>
              <Redirect from="/" to={`${pathPrefix}${defaultRouteConfig[thanosComponent]}`} />

              <PanelList path="/graph" pathPrefix={pathPrefix} />
              <Alerts path="/alerts" pathPrefix={pathPrefix} />
              <Config path="/config" pathPrefix={pathPrefix} />
              <Flags path="/flags" pathPrefix={pathPrefix} />
              <Rules path="/rules" pathPrefix={pathPrefix} />
              <ServiceDiscovery path="/service-discovery" pathPrefix={pathPrefix} />
              <Status path="/status" pathPrefix={pathPrefix} />
              <TSDBStatus path="/tsdb-status" pathPrefix={pathPrefix} />
              <Targets path="/targets" pathPrefix={pathPrefix} />
              <Stores path="/stores" pathPrefix={pathPrefix} />
              <Blocks path="/blocks" pathPrefix={pathPrefix} />
              <Blocks path="/loaded" pathPrefix={pathPrefix} view="loaded" />
              <NotFound pathPrefix={pathPrefix} default defaultRoute={defaultRouteConfig[thanosComponent]} />
            </Router>
          </QueryParamProvider>
        </Container>
      </ErrorBoundary>
    </ThemeContext.Provider>
  );
};
```

[pkg/ui/react-app/src/App.tsx](https://github.com/thanos-io/thanos/blob/df1f3f3d5e72769dc639cb6006a7972b168672ce/pkg/ui/react-app/src/App.tsx) · [More projects using @reach/router →](https://dashboard.exa.ai/playground/search?q=%40reach/router%20GitHub%20projects)

**Quickstart**

```tsx
import { Router } from '@reach/router';

function Home(_props: { path?: string }) { return <h1>Home</h1>; }
export default function App() { return <Router><Home path='/' /></Router>; }

```

From [Router.md](https://raw.githubusercontent.com/reach/router/d2c9ad06715c9d48c2d16f55f7cd889b626d2521/website/src/markdown/api/Router.md)

### gatsby

[GitHub](https://github.com/gatsbyjs/gatsby) · [npm](https://www.npmjs.com/package/gatsby) · [Docs](https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby#readme)

Generates sites with React.

- Downloads / mo: 1.2M
- Stars: 55.9K
- Last release: 5.16.1
- License: MIT
- Capabilities: [From the gatsby docs](https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby#readme)

```sh
npm install gatsby react react-dom
```

**gatsbyjs/gatsby-starter-blog** (3.5K stars)

[gatsbyjs/gatsby-starter-blog](https://github.com/gatsbyjs/gatsby-starter-blog) 

```tsx
const Layout = ({ location, title, children }) => {
  const rootPath = `${__PATH_PREFIX__}/`
  const isRootPath = location.pathname === rootPath
  let header

  if (isRootPath) {
    header = (
      <h1 className="main-heading">
        <Link to="/">{title}</Link>
      </h1>
    )
  } else {
    header = (
      <Link className="header-link-home" to="/">
        {title}
      </Link>
    )
  }

  return (
    <div className="global-wrapper" data-is-root-path={isRootPath}>
      <header className="global-header">{header}</header>
      <main>{children}</main>
      <footer>
        © {new Date().getFullYear()}, Built with
        {` `}
        <a href="https://www.gatsbyjs.com">Gatsby</a>
      </footer>
    </div>
  )
}
```

[src/components/layout.js](https://github.com/gatsbyjs/gatsby-starter-blog/blob/d75052245100ae3c98807c5f38c6e7ec68910e74/src/components/layout.js) · [More projects using gatsby →](https://dashboard.exa.ai/playground/search?q=gatsby%20GitHub%20projects)

**Quickstart**

```tsx
import { Link } from 'gatsby';

export default function Home() {
  return <Link to='/about'>About</Link>;
}

```

From [README.md](https://www.gatsbyjs.com/docs/reference/built-in-components/gatsby-link/)

### react-router5

[GitHub](https://github.com/router5/router5) · [npm](https://www.npmjs.com/package/react-router5) · [Docs](https://router5.js.org)

Provides router5 helpers for React.

- Downloads / mo: 42.8K
- Stars: 1.7K
- Last release: 8.0.1
- License: MIT
- Capabilities: [From the react-router5 docs](https://router5.js.org)

```sh
npm install react-router5 router5 router5-plugin-browser react react-dom
```

**crazyfactory/ts-react-boilerplate** (116 stars)

[crazyfactory/ts-react-boilerplate](https://github.com/crazyfactory/ts-react-boilerplate) 

```tsx
public render(): JSX.Element {
    const {translations} = this.props;
    const routes = getRoutes();
    return (
      <nav className={classNames.nav}>
        <ul>
          <li>
            <ConnectedLink activeClassName={classNames.activeLink} routeName={routes.homePage.name}>
              {translations.home}
            </ConnectedLink>
          </li>
          <li>
            <ConnectedLink activeClassName={classNames.activeLink} routeName={routes.aboutPage.name}>
              {translations.aboutUs}
            </ConnectedLink>
          </li>
          <li>
            <ConnectedLink activeClassName={classNames.activeLink} routeName={routes.counterPage.name}>
              {translations.counter}
            </ConnectedLink>
          </li>
          <li>
            <ConnectedLink activeClassName={classNames.activeLink} routeName={routes.starsPage.name}>
              {translations.stars}
            </ConnectedLink>
          </li>
        </ul>
      </nav>
    );
  }
```

[src/app/containers/Header.tsx](https://github.com/crazyfactory/ts-react-boilerplate/blob/4ee1668b78cd707564aef95d0e1405ce02c231d0/src/app/containers/Header.tsx) · [More projects using react-router5 →](https://dashboard.exa.ai/playground/search?q=react-router5%20GitHub%20projects)

**Quickstart**

```tsx
import { createRoot } from 'react-dom/client';
import createRouter from 'router5';
import browserPlugin from 'router5-plugin-browser';
import { RouterProvider, Link } from 'react-router5';

const router = createRouter([{ name: 'home', path: '/' }]);
router.usePlugin(browserPlugin());
router.start();
createRoot(document.getElementById('root')!).render(
  <RouterProvider router={router}><Link routeName='home'>Home</Link></RouterProvider>
);

```

From [README.md](https://raw.githubusercontent.com/router5/router5/master/packages/react-router5/README.md)

## FAQ

### Which React routing library should I use?

[react-router](#react-router) suits apps that start with declarative routing and add data loading later. [@tanstack/react-router](#tanstack-router) suits apps that want typed paths, search parameters, and cached route data. [wouter](#wouter) suits small apps that route through hooks or route components.

### What is React Router?

[react-router](#react-router) matches URLs to React interfaces, with optional data routing and a full framework mode. Its loaders and actions run in Data Mode.

### What is TanStack Router?

[@tanstack/react-router](#tanstack-router) provides typed React navigation, nested route trees, and cached per-route data loaders.

### React Router vs TanStack Router: which should I use?

[react-router](#react-router) suits apps that choose features by mode, from declarative routing to a full framework. [@tanstack/react-router](#tanstack-router) suits apps that want types inferred through every route and built-in stale-while-revalidate caching.

### What is wouter?

[wouter](#wouter) provides hook-based location control and component-based routing for React and Preact applications.

## How this page was built

Data checked Nov 20, 2026.

Reproduce it with the Exa API:

```json
{
  "endpoint": "/search",
  "body": {
    "query": "Best React routing libraries React Router TanStack Router wouter Next.js examples",
    "numResults": 5
  }
}
```

Docs: https://exa.ai/docs/reference/search
