Packages

react-router

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

Your version

7.10.0

2 Dec 2025Where it was published

7.18.6 is the newest release of 7.x.

In short

1 breaking1 new1 faster6 fixed4 changed

  • Breaking

    ⚠️ This is a breaking change if you have begun using fetcher.unstable_reset()

Security

13 advisories affect 7.10.0; 7.18.0 fixes them

8 more

Release note

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

Minor Changes

  • Stabilize fetcher.reset()

    • ⚠️ This is a breaking change if you have begun using fetcher.unstable_reset()

  • Stabilize the dataStrategy match.shouldRevalidateArgs/match.shouldCallHandler() APIs.

    • The match.shouldLoad API is now marked deprecated in favor of these more powerful alternatives

    • If you're using this API in a custom dataStrategy today, you can swap to the new API at your convenience:

      // Before
      const matchesToLoad = matches.filter((m) => m.shouldLoad);
      
      // After
      const matchesToLoad = matches.filter((m) => m.shouldCallHandler());
    • match.shouldRevalidateArgs is the argument that will be passed to the route shouldRevaliate function

    • Combined with the parameter accepted by match.shouldCallHandler, you can define a custom revalidation behavior for your dataStrategy:

    const matchesToLoad = matches.filter((m) => {
      const defaultShouldRevalidate = customRevalidationBehavior(
        match.shouldRevalidateArgs,
      );
      return m.shouldCallHandler(defaultShouldRevalidate);
      // The argument here will override the internal `defaultShouldRevalidate` value
    });

Patch Changes

  • Fix a Framework Mode bug where the defaultShouldRevalidate parameter to shouldRevalidate would not be correct after action returned a 4xx/5xx response (true when it should have been false)

    • If your shouldRevalidate function relied on that parameter, you may have seen unintended revalidations

  • Fix fetcher.submit failing with plain objects containing a tagName property

  • [UNSTABLE] Add unstable_pattern to the parameters for client side unstable_onError, refactor how it's called by RouterProvider to avoid potential strict mode issues

  • Add new unstable_useTransitions flag to routers to give users control over the usage of React.startTransition and React.useOptimistic.

    • Framework Mode + Data Mode:

      • <HydratedRouter unstable_transition>/<RouterProvider unstable_transition>

      • When left unset (current default behavior)

        • Router state updates are wrapped in React.startTransition

        • ⚠️ This can lead to buggy behaviors if you are wrapping your own navigations/fetchers in React.startTransition

        • You should set the flag to true if you run into this scenario to get the enhanced useOptimistic behavior (requires React 19)

      • When set to true

        • Router state updates remain wrapped in React.startTransition (as they are without the flag)

        • Link/Form navigations will be wrapped in React.startTransition

        • A subset of router state info will be surfaced to the UI during navigations via React.useOptimistic (i.e., useNavigation(), useFetchers(), etc.)

          • ⚠️ This is a React 19 API so you must also be React 19 to opt into this flag for Framework/Data Mode

      • When set to false

        • The router will not leverage React.startTransition or React.useOptimistic on any navigations or state changes

    • Declarative Mode

      • <BrowserRouter unstable_useTransitions>

      • When left unset

        • Router state updates are wrapped in React.startTransition

      • When set to true

        • Router state updates remain wrapped in React.startTransition (as they are without the flag)

        • Link/Form navigations will be wrapped in React.startTransition

      • When set to false

        • the router will not leverage React.startTransition on any navigations or state changes

  • Fix the promise returned from useNavigate in Framework/Data Mode so that it properly tracks the duration of popstate navigations (i.e., navigate(-1))

  • Fix internal type error in useRoute types that surfaces when skipLibCheck is disabled

  • Preserve statusText on the ErrorResponse instance when throwing data() from a route handler

  • Optimize href() to avoid backtracking regex on splat

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.