Packages

react-router

8.5.1 · 27 Oct 2026MIT80.5M / weekRepositorynpmAtom feed

Your version

7.0.0

major22 Nov 2024Where it was published

7.18.6 is the newest release of 7.x.

In short

23 breaking3 removed6 new7 fixed17 changed1 internal

  • Breaking

    Remove single fetch future flag.

  • Breaking

    Drop support for Node 16, React Router SSR now requires Node 18 or higher

  • Breaking

    Remove future.v7_startTransition flag

  • Breaking

    Remove future.v7_normalizeFormMethod future flag

  • Breaking

    Update minimum node version to 18

  • Breaking

    Remove future.v7_prependBasename from the ionternalized @remix-run/router package

  • Breaking

    Migrate Remix type generics to React Router

  • Breaking

    Remove future.v7_throwAbortReason from internalized @remix-run/router package

Security

13 advisories affect 7.0.0; 7.18.0 fixes them

8 more

Release note

The section about react-router of a note shared by several packages.

Major Changes

  • Breaking

    Remove the original defer implementation in favor of using raw promises via single fetch and turbo-stream. This removes these exports from React Router:

    • defer

    • AbortedDeferredError

    • type TypedDeferredData

    • UNSAFE_DeferredData

    • UNSAFE_DEFERRED_SYMBOL,

  • Breaking

    Collapse @remix-run/router into react-router

  • Breaking

    Remove single fetch future flag.

  • Breaking

    Drop support for Node 16, React Router SSR now requires Node 18 or higher

  • Breaking

    Remove future.v7_startTransition flag

  • Breaking

    Expose the underlying router promises from the following APIs for compsition in React 19 APIs:

    • useNavigate()

    • useSubmit

    • useFetcher().load

    • useFetcher().submit

    • useRevalidator.revalidate

  • Breaking

    Remove future.v7_normalizeFormMethod future flag

  • Breaking

    For Remix consumers migrating to React Router, the crypto global from the Web Crypto API is now required when using cookie and session APIs. This means that the following APIs are provided from react-router rather than platform-specific packages:

    • createCookie

    • createCookieSessionStorage

    • createMemorySessionStorage

    • createSessionStorage

    For consumers running older versions of Node, the installGlobals function from @remix-run/node has been updated to define globalThis.crypto, using Node's require('node:crypto').webcrypto implementation.

    Since platform-specific packages no longer need to implement this API, the following low-level APIs have been removed:

    • createCookieFactory

    • createSessionStorageFactory

    • createCookieSessionStorageFactory

    • createMemorySessionStorageFactory

  • Breaking

    Imports/Exports cleanup

    • Removed the following exports that were previously public API from @remix-run/router

      • types

        • AgnosticDataIndexRouteObject

        • AgnosticDataNonIndexRouteObject

        • AgnosticDataRouteMatch

        • AgnosticDataRouteObject

        • AgnosticIndexRouteObject

        • AgnosticNonIndexRouteObject

        • AgnosticRouteMatch

        • AgnosticRouteObject

        • TrackedPromise

        • unstable_AgnosticPatchRoutesOnMissFunction

        • Action -> exported as NavigationType via react-router

        • Router exported as DataRouter to differentiate from RR's <Router>

      • API

        • getToPathname (@private)

        • joinPaths (@private)

        • normalizePathname (@private)

        • resolveTo (@private)

        • stripBasename (@private)

        • createBrowserHistory -> in favor of createBrowserRouter

        • createHashHistory -> in favor of createHashRouter

        • createMemoryHistory -> in favor of createMemoryRouter

        • createRouter

        • createStaticHandler -> in favor of wrapper createStaticHandler in RR Dom

        • getStaticContextFromError

    • Removed the following exports that were previously public API from react-router

      • Hash

      • Pathname

      • Search

  • Breaking

    Update minimum node version to 18

  • Breaking

    Remove future.v7_prependBasename from the ionternalized @remix-run/router package

  • Breaking

    Migrate Remix type generics to React Router

    • These generics are provided for Remix v2 migration purposes

    • These generics and the APIs they exist on should be considered informally deprecated in favor of the new Route.* types

    • Anyone migrating from React Router v6 should probably not leverage these new generics and should migrate straight to the Route.* types

    • For React Router v6 users, these generics are new and should not impact your app, with one exception

      • useFetcher previously had an optional generic (used primarily by Remix v2) that expected the data type

      • This has been updated in v7 to expect the type of the function that generates the data (i.e., typeof loader/typeof action)

      • Therefore, you should update your usages:

        • ❌ useFetcher<LoaderData>()

        • ✅ useFetcher<typeof loader>()

  • Breaking

    Remove future.v7_throwAbortReason from internalized @remix-run/router package

  • Breaking

    Add exports field to all packages

  • Breaking

    Node package no longer re-exports from react-router

  • Breaking

    Renamed RemixContext to FrameworkContext

  • Breaking

    Updates the minimum React version to 18

  • Breaking

    PrefetchPageDescriptor replaced by PageLinkDescriptor

  • Breaking

    Consolidate types previously duplicated across @remix-run/router, @remix-run/server-runtime, and @remix-run/react now that they all live in react-router

    • Examples: LoaderFunction, LoaderFunctionArgs, ActionFunction, ActionFunctionArgs, DataFunctionArgs, RouteManifest, LinksFunction, Route, EntryRoute

    • The RouteManifest type used by the "remix" code is now slightly stricter because it is using the former @remix-run/router RouteManifest

      • Record<string, Route> -> Record<string, Route | undefined>

    • Removed AppData type in favor of inlining unknown in the few locations it was used

    • Removed ServerRuntimeMeta* types in favor of the Meta* types they were duplicated from

  • Breaking

    Remove the future.v7_partialHydration flag

    • This also removes the <RouterProvider fallbackElement> prop

      • To migrate, move the fallbackElement to a hydrateFallbackElement/HydrateFallback on your root route

    • Also worth nothing there is a related breaking changer with this future flag:

      • Without future.v7_partialHydration (when using fallbackElement), state.navigation was populated during the initial load

      • With future.v7_partialHydration, state.navigation remains in an "idle" state during the initial load

  • Breaking

    Remove v7_relativeSplatPath future flag

  • Breaking

    Drop support for Node 18, update minimum Node vestion to 20

    • Remove installGlobals() as this should no longer be necessary

  • Breaking

    Remove remaining future flags

    • React Router v7_skipActionErrorRevalidation

    • Remix v3_fetcherPersist, v3_relativeSplatPath, v3_throwAbortReason

  • Breaking

    Rename createRemixStub to createRoutesStub

  • Breaking

    Remove @remix-run/router deprecated detectErrorBoundary option in favor of mapRouteProperties

  • Breaking

    Add react-router/dom subpath export to properly enable react-dom as an optional peerDependency

    • This ensures that we don't blindly import ReactDOM from "react-dom" in <RouterProvider> in order to access ReactDOM.flushSync(), since that would break createMemoryRouter use cases in non-DOM environments

    • DOM environments should import from react-router/dom to get the proper component that makes ReactDOM.flushSync() available:

      • If you are using the Vite plugin, use this in your entry.client.tsx:

        • import { HydratedRouter } from 'react-router/dom'

      • If you are not using the Vite plugin and are manually calling createBrowserRouter/createHashRouter:

        • import { RouterProvider } from "react-router/dom"

  • Breaking

    Remove future.v7_fetcherPersist flag

  • Breaking

    Update cookie dependency to ^1.0.1 - please see the release notes for any breaking changes

Minor Changes

  • Add support for prerender config in the React Router vite plugin, to support existing SSG use-cases

    • You can use the prerender config to pre-render your .html and .data files at build time and then serve them statically at runtime (either from a running server or a CDN)

    • prerender can either be an array of string paths, or a function (sync or async) that returns an array of strings so that you can dynamically generate the paths by talking to your CMS, etc.

    // react-router.config.ts
    import type { Config } from "@react-router/dev/config";
    
    export default {
      async prerender() {
        let slugs = await fakeGetSlugsFromCms();
        // Prerender these paths into `.html` files at build time, and `.data`
        // files if they have loaders
        return ["/", "/about", ...slugs.map((slug) => `/product/${slug}`)];
      },
    } satisfies Config;
    
    async function fakeGetSlugsFromCms() {
      await new Promise((r) => setTimeout(r, 1000));
      return ["shirt", "hat"];
    }
  • Params, loader data, and action data as props for route component exports

    export default function Component({ params, loaderData, actionData }) {}
    
    export function HydrateFallback({ params }) {}
    export function ErrorBoundary({ params, loaderData, actionData }) {}
  • Remove duplicate RouterProvider impliementations

  • Typesafety improvements

    React Router now generates types for each of your route modules.
    You can access those types by importing them from ./+types.<route filename without extension>.
    For example:

    // app/routes/product.tsx
    import type * as Route from "./+types.product";
    
    export function loader({ params }: Route.LoaderArgs) {}
    
    export default function Component({ loaderData }: Route.ComponentProps) {}

    This initial implementation targets type inference for:

    • Params : Path parameters from your routing config in routes.ts including file-based routing

    • LoaderData : Loader data from loader and/or clientLoader within your route module

    • ActionData : Action data from action and/or clientAction within your route module

    In the future, we plan to add types for the rest of the route module exports: meta, links, headers, shouldRevalidate, etc.
    We also plan to generate types for typesafe Links:

    <Link to="/products/:id" params={{ id: 1 }} />
    //        ^^^^^^^^^^^^^          ^^^^^^^^^
    // typesafe `to` and `params` based on the available routes in your app

    Check out our docs for more:

  • Stabilize unstable_dataStrategy

  • Stabilize unstable_patchRoutesOnNavigation

Patch Changes

  • No changes

  • Remove unstable upload handler.

  • Remove unneeded dependency on @web3-storage/multipart-parser

  • Fix redirects returned from loaders/actions using data()

  • react-router: (v7) fix static prerender of non-ascii characters

  • Replace substr with substring

  • Removed

    Remove the deprecated json utility

    • You can use Response.json if you still need to construct JSON responses in your app

  • Remove unneeded dependency on source-map

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.