npm / react-router
react-router
What changed in react-router 5 to 8, from its official release notes, upgrade guides and advisories. Also covers @types/react-router. Sources checked 2026-11-30.
97 breaking31 security10 deprecations62 new APIs and options6 performance37 behavior and defaults16 tooling93 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initreact-router 8102 changes
Breaking changes 22
Internal router contexts are more granular, changing exported unsafe contexts; users of those exports should review the breaking changes.
Components using hooks for only some router state no longer re-render for unrelated state changes; for example, useLocation alone does not re-render when navigation.state transitions to loading.
Path parameters are encoded using RFC 3986 path-segment rules, leaving valid pchar characters such as + unescaped.
Removed the obsolete type export; middleware is always enabled and server request context is provided through RouterContextProvider.
Published packages are ESM-only, so consumers must use an ESM-compatible setup.
The flag was removed because Vite Environment API prerendering is now the default.
The future flag was removed because raw incoming requests are now passed to loaders and actions; use
urlfor the normalized URL.Custom server
getLoadContextfunctions must return aRouterContextProvider; returning a plain object is no longer supported.The internal route field is no longer added to data-router routes or accepted in route objects, JSX props, or lazy route definitions; the router infers it.
create-react-routernow uses nativefetch, removing the underlying proxy support previously provided bynode-fetchand@remix-run/web-fetch.Use
loaderDatainstead of deprecateddatafields inmetaarguments, matched route data, anduseMatches()results.Middleware is always enabled in v8, and the
contextparameter for loaders, actions, and middleware is always aRouterContextProviderinstance.The
MiddlewareEnabledtype, previously exported asUNSAFE_MiddlewareEnabled, was removed because middleware is unconditional.The minimum supported Node version is now 22.22.0.
Prerendering with the Vite Environment API is now the default, replacing the old pre-rendering implementation with the preview server flow.
The minimum supported React version is now 19.2.7.
The Cloudflare dev proxy export was removed; Cloudflare projects should use
@cloudflare/vite-plugininstead.The re-export package is removed in v8; import general APIs from
react-routerand DOM-specific APIs fromreact-router/dom.Trailing slash-aware data request URLs are now the default behavior; the corresponding future flag was removed.
The
createRequestHandleroption was removed because its behavior is now the default.React Router now requires Vite 7 or later.
The Vite Environment API is always enabled, and its build path is mandatory.
Security 7
Streamed RSC redirect locations are correctly escaped in meta tag attributes.
Treat every Server Function as a public endpoint that must perform its own access-control checks; route actions are recommended when route middleware should provide access control.
Improves validation of action request origins.
Adds additional URL validation on client-side navigations and redirects.
React Router: RSC Mode CSRF Bypass Allows Action Execution Before 400 Response
Unstable RSC CSRF code paths are hardened.
A virtual module provides integrity hashes for custom RSC SSR entries to pass through React's importMap render option.
Deprecations 6
The isTransitioning render prop is deprecated in favor of React’s View Transition classes.
The transitioning class is deprecated in favor of React’s View Transition classes.
Deprecated in favor of React’s <ViewTransition> component; the existing API continues to work during React Router v8 and will be removed in v9.
The viewTransition props/options are deprecated in favor of React’s <ViewTransition> component and will be removed in React Router v9.
The branches option is deprecated and ignored because createStaticRouter caches route branches internally; EntryContext.branches remains available but is always empty.
Deprecates the flag ahead of its removal in React Router v9.
New APIs and options 24
The route discovery hook exposes discoverRoutes(paths) to load route metadata without navigating or loading route modules.
A custom manifest-mismatch handler can call event.defaultBehavior() to explicitly run built-in recovery.
Enable application-controlled route discovery in conventional Framework Mode while retaining automatic discovery unless a custom mismatch handler is provided.
The route discovery hook exposes loadAllRoutes() to load the running client's full route manifest.
The route discovery hook exposes shared discovery state with partial, loading, or complete values.
Configure the origin for API-only loader, action, and route discovery requests when the API server runs on a separate origin.
Pass a callback to HydratedRouter to customize JavaScript-issued manifest and server data requests; the callback receives the request and request-type context.
Data strategies receive request-type metadata equivalent to the custom fetch context.
Data strategies receive navigation type metadata, including PUSH, REPLACE, or POP for navigation-initiated data requests.
Discover selected destinations or load the running client's complete route manifest without loading route modules or navigating.
Data Mode can opt into a more efficient route matcher powered by @remix-run/route-pattern; preload the matcher before enabling the flag.
Use the opted-in router's match API when matching with the new route matcher; the API is private and unstable until the flag stabilizes.
Preloads the new route matcher before enabling the route-pattern matching flag, so applications that do not opt in avoid downloading the matcher.
Route definitions can provide keyed regular expressions to reject invalid parameter values and continue matching later routes; absent optional parameters are not validated.
The subResourceIntegrity config option is supported in RSC Framework Mode.
Custom RSC entry.rsc.tsx files should pass the generated client version so stale RSC clients can be detected during lazy route discovery and the destination document reloaded.
RSC document rendering accepts a nonce that is forwarded to the HTML renderer and injected RSC payload scripts.
RSC document rendering accepts a nonce for nonce-aware framework components.
A virtual module provides the RSC client build version for custom RSC entries.
Node Framework Mode apps can opt into a default server entry using renderToReadableStream instead of renderToPipeableStream; the flag has no effect when a custom entry.server.tsx exists.
Skip copying the official React Router agent skill into a generated project.
Instrumentation results for server requests, client navigations, and client fetches now include URL, matched route pattern, and params metadata.
Server request handler instrumentation results now expose known HTTP status codes.
The option replaces
future.v8_splitRouteModulesand defaults totrue; set it tofalseto keep route modules in one chunk or to"enforce"to require splittable routes.
Performance 2
Improves route matching performance for long paths.
In unstable RSC apps, rendered route component metadata is preserved so routes with a clientLoader can skip unnecessary server requests while still fetching missing server-rendered elements.
Behavior and default changes 5
Framework Mode can serve static HTML while retaining a runtime server for loaders, actions, revalidation, and lazy route discovery.
Serves
/.well-known/*files from the client build directory while keeping other dotfiles hidden.Non-Node Framework Mode apps use a default server entry based on renderToReadableStream, so they no longer need a custom entry.server.tsx solely to use Web Streams.
Framework mode apps add the node Vite server condition only when they declare a Node server adapter dependency, preventing non-Node SSR runtimes from resolving Node-specific package exports by default.
The TypeScript target is now ES2022.
Tooling 6
Declared as an optional peer dependency so shipped type definitions resolve React types under strict, non-hoisted node_modules layouts.
When not already configured, react-router dev restarts with --conditions=development.
TypeScript 7 can be used with the listed React Router packages and adapters.
The framework dependency installer and project creator detect nub as a supported package manager.
Generated projects include the official React Router agent skill by default with --yes or in non-interactive shells; interactive runs prompt with yes as the default.
The TypeScript library setting is now ES2022.
Fixes and other changes 30
Promises decoded from an RSC payload now server render without causing the Suspense boundary to switch to client rendering.
A reset fetcher is no longer revalidated, preventing its cleared data from returning on the next revalidation.
During initial hydration, a route discovered through patchRoutesOnNavigation is exposed in state.matches so RouterProvider renders its HydrateFallback while loaders run.
Prerender requests use the address bound by the Vite preview server and avoid re-resolving localhost to a different address family.
Request URLs no longer lose their port when the Host or X-Forwarded-Host header is an IPv6 address.
File session commits write to a temporary file and rename it into place to prevent concurrent commits from corrupting session files, while preserving existing permissions.
Document-request middleware short-circuit responses in RSC modes are returned as-is instead of decoding non-RSC bodies as Flight.
Declared as an optional peer dependency so shipped type definitions resolve React types under strict, non-hoisted node_modules layouts.
Avoids unintended view-transition calls during initial hydration and router.revalidate() calls.
Revalidation against a splat route during lazy route discovery waits for the current load's discovery, even when a fetcher key is reused, and restarts interrupted loaders after discovery completes.
SPA navigations preserve lazy route module import errors instead of replacing them with a missing dataStrategy result error.
react-router dev and vite preview use X-Forwarded-Proto when constructing request.url, fixing action submissions behind HTTPS reverse proxies; the URL host still comes from Host.
Manifest version-mismatch recovery no longer loads stale routes or repeatedly reloads; pending requests can fail so subsequent requests can recover if reload does not complete or the document is restored from back-forward cache.
The underlying decode failure is preserved as the cause of this error.
Fixes a memory leak that retained memory for the lifetime of a long-running stream while preserving error handling when a producer closes the destination.
Prevents client disconnects during streaming from crashing the Node process.
Fixes an Expected fetcher: <key> error on navigation when a fetcher is aborted during post-action revalidation.
Prevents an aborted navigation from caching a path as discovered before the route tree is patched, which could shadow the real route or cause repeated 404s.
Fixes history.scrollRestoration remaining set to auto after a bfcache restore, which could let the browser restore scroll before the destination route rendered.
Properly respects the relative option when resolving the action path.
NavLink now applies its pending state when
tohas a trailing slash.Aborting a request while the RSC HTML stream has a pending flush no longer causes a server crash.
href() now stringifies and URL-encodes parameter values to match generatePath(); splat parameters preserve path separators while encoding each segment individually.
Navigation blocker state is preserved through a revalidation.
Dynamic parameter extraction now handles routes with optional static segments, including consecutive optional segments.
ReactFormState types are used instead of unknown.
React Router detects user rolldownOptions configuration in Vite 8+.
Dynamic parameters with static extension suffixes are correctly identified and ranked, preventing them from outranking truly static routes based on definition order.
The react-router.config.ts buildEnd hook now runs after prerendering is completed.
Fixes crashes under the Bun runtime when Babel default imports are already unwrapped.
react-router 7222 changes
Breaking changes 64
Action request origins are now validated against the host in the constructed request URL instead of HTTP headers. Behind a reverse proxy, applications may need to add the internal host to allowedActionOrigins.
The unstable flag is no longer supported and causes an error during config resolution.
Stabilizes the trailing-slash-aware data requests future flag under this name.
Removes the stale, invalid unpkg field from the react-router-dom re-export package.
Moves subresource integrity configuration from the unstable FutureConfig flag to a top-level config option.
Renames unstable_defaultShouldRevalidate to defaultShouldRevalidate on Link, Form, useLinkClickHandler, useSubmit, fetcher.submit, and setSearchParams.
Renames future.unstable_passThroughRequests to future.v8_passThroughRequests in React Router and @react-router/dev.
Renames unstable_instrumentations to instrumentations and removes unstable_ prefixes from associated instrumentation types.
Stabilizes unstable_normalizePath as normalizePath on staticHandler.query and staticHandler.queryRoute.
Stabilizes unstable_pattern as pattern on loader, action, middleware, and instrumentation arguments.
Renames prerender.unstable_concurrency to prerender.concurrency.
Stabilizes the url argument on loader, action, and middleware functions, removing its unstable_ prefix.
React Router automatically serializes
Errorand its standard subtypes, but no longer applies undocumented custom error serialization.Optional params no longer match paths lacking a separating slash; for example,
/users/:id?no longer matches/usersblah.Adds a CSRF protection layer by rejecting submissions to UI routes from external origins.
When a dataStrategy implementation returns too few results, errors are added for routes without an available result.
The routeRSCServerRequest API replaces fetchServer with serverResponse.
Stabilizes this future flag, replacing future.unstable_splitRouteModules in react-router.config.ts.
Stabilizes this future flag, replacing future.unstable_viteEnvironmentApi in react-router.config.ts.
Client-side error handlers receive location and params in the second argument, alongside errorInfo; this is a breaking change for existing adopters.
The export for
unstable_RSCHydratedRouterand its utils moves toreact-router/dom.The Cloudflare development proxy plugin export is renamed and moved to @react-router/dev/vite/cloudflare.
createCookie is provided from react-router rather than platform-specific packages; cookie and session APIs require the Web Crypto API crypto global.
The low-level createCookieFactory API is removed because platform-specific packages no longer need to implement cookie APIs.
createCookieSessionStorage is provided from react-router rather than platform-specific packages; cookie and session APIs require the Web Crypto API crypto global.
The low-level createCookieSessionStorageFactory API is removed because platform-specific packages no longer need to implement session APIs.
createMemorySessionStorage is provided from react-router rather than platform-specific packages; cookie and session APIs require the Web Crypto API crypto global.
The low-level createMemorySessionStorageFactory API is removed because platform-specific packages no longer need to implement session APIs.
createRemixStub is renamed to createRoutesStub.
createSessionStorage is provided from react-router rather than platform-specific packages; cookie and session APIs require the Web Crypto API crypto global.
The low-level createSessionStorageFactory API is removed because platform-specific packages no longer need to implement session APIs.
The defer API and its original implementation are removed in favor of raw promises via single fetch and turbo-stream.
The former esbuild-based compiler is no longer available; the Remix Vite plugin is the supported way to build full-stack SSR apps.
The Remix fetcher persistence behavior previously behind this future flag is now the default.
The lazy route discovery behavior previously behind this future flag is now the default.
The Remix relative splat path behavior previously behind this future flag is now the default.
The single fetch behavior previously behind this future flag is now the default.
The Remix abort reason behavior previously behind this future flag is now the default.
The fetcher persistence behavior previously behind this future flag is now the default.
The form method normalization behavior previously behind this future flag is now the default.
The partial hydration behavior previously behind this future flag is now the default.
The relative splat path behavior previously behind this future flag is now the default.
The action status revalidation behavior previously behind this future flag is now the default.
The startTransition behavior previously behind this future flag is now the default.
The json utility is removed; use Response.json if you still need to construct JSON responses.
The Vite plugin manifest option is removed; use the buildEnd hook, which receives buildManifest, for dependent logic or writing the manifest to disk.
React Router v7 requires Node 20; it no longer provides installGlobals to polyfill the fetch API.
PrefetchPageDescriptor is replaced by PageLinkDescriptor.
Cloudflare Pages and Workers packages have been consolidated into @react-router/cloudflare.
The react-router-dom-v5-compat package is removed starting with v7.
DOM environments should import RouterProvider or HydratedRouter from react-router/dom to make ReactDOM.flushSync available.
The react-router-native package is removed starting with v7.
The react-router-dom, @remix-run/react, @remix-run/server-runtime, and @remix-run/router packages have been collapsed into react-router; react-router-dom remains as a re-export for migration.
Common runtime APIs are imported from react-router rather than runtime adapter packages.
React Router v7 requires React 18 and react-dom 18.
The Vite plugin export is renamed and moved from @remix/dev to @react-router/dev/vite.
RemixContext is renamed to FrameworkContext.
The fallbackElement prop is removed; move the fallback to hydrateFallbackElement or HydrateFallback on the root route.
With partial hydration behavior, state.navigation remains idle during the initial load instead of being populated.
The unstable_composeUploadHandlers API is removed.
The unstable_createMemoryUploadHandler API is removed.
The unstable_parseMultipartFormData API is removed.
The sibling url parameter contains a URL instance with React Router's internal implementation details removed; request.url is the original request URL.
The useFetcher generic now expects the type of the function generating the data, such as typeof loader or typeof action, rather than the data type.
Security 23
React Router: Arbitrary Constructor Injection via deserializeErrors() in React Router SSR Hydration
The Express adapter adjusts host computation, reading the port from x-forwarded-host according to the trust proxy setting and handling invalid hostname characters.
React Router: Open redirect via backslash in <Link> and useNavigate (CVE-2025-68470 bypass)
React Router: RSCErrorHandler Missing Protocol Validation (XSS)
React Router: Unauthenticated Denial of Service via Inefficient Route Matching
Protocols are now validated in RSC render redirects.
Nonce-aware SSR components use the ServerRouter nonce when they do not provide their own value, allowing them to load on strict CSP pages.
React Router: Potential CSRF via PUT/PATCH/DELETE document requests
React Router vulnerable to DoS via unbounded path expansion in __manifest endpoint
React Router's vendored turbo-stream v2 allows arbitrary constructor invocation via TYPE_ERROR deserialization leading to Unauth RCE
React Router's same-origin redirect with path starting // causes open redirect via protocol-relative URL reinterpretation
React Router vulnerable to Denial of Service via reflected user input in single-fetch
React Router has stored XSS via unescaped Location header in prerendered redirect HTML
React Router vulnerable to XSS in unstable RSC redirect handling via javascript: redirect targets
Fixes the missing nonce on inline criticalCss.
React Router: Open redirect leading to XSS
React Router has CSRF issue in Action/Server Action Request Processing
React Router SSR XSS in ScrollRestoration
React Router vulnerable to XSS via Open Redirects
Validates redirect locations.
Escapes HTML in scroll restoration keys.
The @react-router/dev dependency was updated to address GHSA-vqpr-j7v3-hqw9.
React Router has unexpected external redirect via untrusted paths
Deprecations 2
Logs a future flag warning for this upcoming React Router v8 flag.
Marks match.shouldLoad deprecated in favor of the more powerful shouldCallHandler and shouldRevalidateArgs APIs.
New APIs and options 34
The Architect createRequestHandler option derives request URL hosts from the API Gateway request context; adopting it prepares for the behavior to become the default in v8.
A subset of the official Markdown documentation is now shipped in the package for local access by AI coding agents and React Router agent skills.
Adds an unstable hook for Framework and Data Mode that consolidates access to active and pending router states; it throws when used without a data router.
Scripts adds the provided nonce to modulepreload link elements.
Supports Link prefetch in RSC Framework Mode.
Adds prerendering and SPA Mode support for RSC Framework Mode.
Unstable RSC Framework Mode adds route module server-component exports: ServerComponent, ServerErrorBoundary, ServerLayout, and ServerHydrateFallback. Existing adopters may need to rename exports to keep them server components.
Disables request URL normalization so handlers receive the raw HTTP request, allowing them to distinguish document from data requests and avoiding multiple Request constructions.
Adds a URL parameter to route handlers containing the normalized location, so routing logic can use it when request.url is raw.
Adds the unstable RSC
unstable_getRequestAPI.Adds URL masking to Framework/Data Mode through <Link unstable_mask>; the masked location is available on useLocation().unstable_mask. Masked URLs are for SPA use cases and are removed from history.state during SSR.
Adds a crossOrigin prop to the Links component.
Adds a react-router.config.ts field for specifying external origins permitted to submit to UI routes.
Adds an opt-in flag that makes request.pathname consistent across document and data requests when the browser URL has a trailing slash, using a new
_.dataformat for client-side data requests.Exports this history creator to help apps using
unstable_HistoryRoutermigrate from v6 to v7.RSC Framework mode supports custom entrypoints.
In RSC, data() can be thrown during server component rendering to transmit data to the boundary.
RSC supports throwing redirect Responses at render time.
Navigation and fetcher APIs accept this flag to opt out of standard revalidation; route shouldRevalidate functions receive its value and have the final say.
Adds unstable_pattern to the parameters for client-side unstable_onError.
Adds an opt-in prop for HydratedRouter and RouterProvider to wrap Link/Form navigations in transitions and surface optimistic navigation state; requires React 19 for Framework/Data Mode.
Adds a router flag to control use of React.startTransition and React.useOptimistic; behavior depends on the flag value and mode.
Add an option to run pre-rendering concurrently, potentially speeding up the build.
Add instrumentation for route loaders, actions, middleware, lazy routes, server request handlers, and client navigations and fetches.
Loaders, actions, and middleware receive the un-interpolated route pattern, useful for aggregating logs and metrics by route.
Enables middleware to run code before and after Response generation for matched paths, supporting reusable authentication, logging, error handling, and data preprocessing.
Passes the raw HTTP request to handlers instead of normalizing its URL; use the sibling
urlparameter for normalized routing logic.Enables client-side route exports to be split into independently loadable chunks, so they can load and execute while route component code is downloading.
Preserves trailing-slash semantics in Framework mode data request URLs, including changing the root data request from
/_root.datato/_.data.The Vite plugin adds a prerender config for SSG, pre-rendering .html and .data files at build time for static serving from a server or CDN.
A react-router/dom subpath export provides DOM-specific RouterProvider and HydratedRouter with ReactDOM.flushSync support, keeping react-dom optional for non-DOM use cases.
The Vite plugin uses app/routes.ts to define routes, exporting a RouteConfig built with route, index, and layout helpers.
Route component exports receive params, loader data, and action data as props.
The Architect adapter can opt into using
event.requestContext.domainNamewhen creating the request, falling back to theHostheader.
Performance 3
Precomputes and caches flattened/ranked route branches and avoids unnecessary matchRoutes calls, improving server-side handling and client-side navigation performance.
RSC Framework mode optimizes react-server-dom-webpack when it is present in the project package.json.
Optimizes href() to avoid backtracking regex on splat.
Behavior and default changes 27
When this option is enabled, Framework Mode build hooks now ignore external Vite server environments and process only the app's own server build.
When enabled, RSC route module server exports are no longer scanned by the client dependency optimizer.
Memoizes the hook result so it has a stable identity and changes only when fetchers change.
Renames unstable_mask to mask on Link, useLinkClickHandler, useNavigate, and Location; Location.mask is optional.
Stabilizes unstable_useTransitions as useTransitions on router components and useLinkClickHandler.
Supports prerendering multiple server bundles when using this Vite environment API.
Loosens the glob check so ** matches all domains.
Client-side middleware can now return redirects.
RSC Framework mode now manually chunks react and react-router dependencies.
The client-side error handler is stable on RouterProvider and HydratedRouter; replace the former unstable_onError prop if you adopted it.
RSC supports throwing Response from the server component render phase, but its body is not serialized because async work is not allowed during error encoding.
Stabilizes this dataStrategy match API, replacing match.unstable_shouldCallHandler().
Stabilizes this dataStrategy match API, replacing match.unstable_shouldRevalidateArgs.
Stabilizes fetcher.reset() as the replacement for fetcher.unstable_reset().
Environment variables are loaded before routes.ts is evaluated, allowing route configuration to be computed from VITE_-prefixed variables.
Actions may now return undefined.
The optimize dependencies behavior previously behind this future flag is now the default.
Link gains prefetching support when using Remix SSR.
Loaders may now return undefined.
NavLink gains prefetching support when using Remix SSR.
unstable_dataStrategy is stabilized.
unstable_patchRoutesOnNavigation is stabilized.
useFetcher().load now exposes the underlying router promise for composition in React 19 APIs.
useFetcher().submit now exposes the underlying router promise for composition in React 19 APIs.
useNavigate now exposes the underlying router promise, allowing composition with React 19 promise-handling APIs.
useRevalidator().revalidate now exposes the underlying router promise for composition in React 19 APIs.
useSubmit now exposes the underlying router promise, allowing composition with React 19 promise-handling APIs.
Tooling 9
Consumers of the unstable
unstable_reactRouterRSCVite plugin must install@vitejs/plugin-reactand add the React plugin to their Vite plugins array.Adds TypeScript 6 support to the package's peer dependency ranges.
The reveal command supports RSC Framework Mode for entry.client, entry.rsc, and entry.ssr.
React Router adds support for Vite 8.
Framework mode now supports vite preview, making it easy to preview a production build.
Cloudflare projects should use this package instead of the React Router Cloudflare dev proxy.
Enables support for Vite's experimental Environment API; custom Vite configuration relying on
isSsrBuildmay need to move into per-environment configuration.Route module types are generated and available through imports from ./+types/<route filename without extension>.
React Router generates types for each route module and passes typed props to route component exports; import generated types from ./+types/<route filename without extension>.
Fixes and other changes 60
Corrected the package.json main field for CommonJS builds.
Fixes server handler prerender responses when ssr is false and future.v8_trailingSlashAwareDataRequests is enabled, avoiding false-positive SPA Mode detection.
Vite server.watch configuration is passed to the child compiler in development mode.
URL normalization logic is consolidated and handles mixed slashes better.
Future flag warning URLs are fixed so warnings point to the correct resources.
Each future flag warning is logged only one time.
react-router-serve normalizes path separators so Windows-built server artifacts can serve /assets/* correctly when run on Linux.
Browser URL creation uses the configured history window rather than the global window, preserving the correct URL origin in custom window contexts.
The manifest path is disabled when lazy route discovery is disabled.
The JSON-LD script type accepts one or multiple LdJsonObject values, allowing multiple schemas in a single script tag emitted by Meta.
Ignores writes after Express responses close, avoiding adapter errors for client disconnects when the response stream is destroyed or ended.
Its return type now preserves the discriminated union across navigation states.
Honors writable backpressure by awaiting drain and rejects if the writable errors or closes mid-stream.
Honors writable backpressure by awaiting drain and rejects if the writable errors or closes mid-stream.
Fixes basename conflicts with the app directory when Vite base and React Router basename both match that directory, preventing server-build virtual module import errors.
Updates fetcher Maps immutably to prevent delayed React renders from reading an updated but uncommitted Map, which could cause brief flickers in fetcher-driven optimistic UI.
Calls the onError callback for synchronous initial loader errors in SPA mode.
Fixes stale SSR data when a client navigation aborts pending hydration before the hydration clientLoader resolves.
Fixes single-fetch calls incorrectly including parent routes without shouldRevalidate when defaultShouldRevalidate is false.
Parent middleware redirects are now properly handled during
fetcher.load.The
paramargument types rejectnullfor required params, allow omitted optional params, and allow extra keys.Typegen now emits
pages: never;for layouts with no pages instead of producing invalidpages: ;.The unstable
unstable_reactRouterRSCVite plugin more reliably splits route modules.The
react-router/domRouterProviderno longer redundantly omitsflushSyncfrom its props.Fixes a potential race condition when initial loaders land before the RouterProvider layout effect calls router.subscribe.
Double slashes in redirect paths are normalized.
Fixes a memory leak caused by an AbortSignal listener that was not removed.
The vendored turbo-stream implementation no longer recurses, allowing large payloads to be encoded and decoded.
Fixes clientLoader.hydrate when an ancestor route is also hydrating a clientLoader.
Fixes a type error when passing Framework Mode route components using Route.ComponentProps to createRoutesStub.
Fixes a crash when Unix socket files exist in the project root.
Fixes percent encoding in relative path navigation.
Fixes HydrateFallback rendering during initial lazy route discovery when a splat route matches.
Preserves query parameters and the hash when reloading after a manifest version mismatch.
Failed origin checks in RSC now return a 400 status and appropriate UI instead of a generic 500.
Improves the error message shown when the Origin header is invalid.
Failed origin checks return a 400 status instead of a 500.
Fixes route file paths when the routes directory is outside the app directory.
Fixes double slash normalization for paths with a colon.
Preserves
clientLoader.hydrate=truewhen using<HydratedRouter unstable_instrumentations>.Fixes path generation when parameters have suffixes, such as
/books/:id.json.Fixes Maximum call stack size exceeded errors when HMR runs against code with cyclic imports.
Passes the
<Scripts nonce>value to the underlying importmap script tag whenfuture.unstable_subResourceIntegrityis enabled.Skips SSR middleware in the vite preview server when running in SPA mode.
The Router component now permits omission of the unstable_useTransitions prop for backwards compatibility.
The package now imports the ESM package pkg-types with a dynamic import to fix issues on Node 20.18.
The React 18 stub now uses a stable setter function to avoid potential useEffect loops, particularly with <Link viewTransition>.
Preserves statusText on the ErrorResponse instance when a route handler throws data().
Fixes submission failures for plain objects containing a tagName property.
Corrects defaultShouldRevalidate after an action returns a 4xx/5xx response, preventing unintended revalidations when functions rely on that parameter.
In Framework/Data Mode, the returned promise now properly tracks the duration of popstate navigations such as navigate(-1).
Properly handles ancestor thrown middleware errors before next() on fetcher submissions.
Fixes splat routes interfering with multiple calls to patchRoutesOnNavigation.
Loads the ESM-only p-map dependency with a dynamic import to avoid issues on Node 20.18 and below.
Normalizes double-slashes in resolvePath.
Action handlers now run for routes with middleware even when no loader is present.
Route navigation no longer removes CSS
linkelements used by dynamic imports.Type generation registers route module types only for routes within the app directory.
The
handlefield is now type-safe when accessed throughunstable_useRoute().ScrollRestoration can now restore properly on an SSR'd document load.
react-router 69 changes
Breaking changes 7
Fixes double slash normalization for colon URLs. navigate() is intended for in-app navigations, not external navigations to other domains; this may be a breaking bug fix for users who used it for external navigation.
Relative link targets resolve against the route path; search-only targets use the current pathname, and trailing slashes do not change the link destination.
The element prop lets route definitions render elements, pass custom props including children, and use React.Suspense for lazy-loaded route elements.
Relative route paths are resolved against the parent route, so nested routes no longer need paths built from the root.
Routes are ranked automatically, so the best match is selected regardless of definition order and routes are less likely to become unreachable.
Replaces Switch with a component that automatically picks the best route for the current URL and allows routes to be spread across the app.
A * at the end of a route path opts into deep matching, allowing additional routing in a nested component.
New APIs and options 1
Adds first-class support for layout routes, rendering nested route content within a parent layout.
Performance 1
The decodePath call was lifted out of the hot path during route matching.
react-router 519 changes
Breaking changes 4
Development mode throws an error when different builds are combined, such as CJS imports with ESM imports.
Access to the old context API fails; use withRouter() or a <Route/> instead.
Mixing per-file imports with package-level imports can cause a context mismatch; import both components from the same build.
react-router and react-router-dom (or react-router-native) must be upgraded to the exact same version to avoid errors with router components.
Security 1
Development builds no longer use eval, making them compliant with unsafe-eval CSP.
Deprecations 2
Per-file imports are deprecated and log a warning; they will be removed in a future major version.
Import router exports by destructuring them from the main bundle; requiring individual router files remains supported but warns in development.
New APIs and options 3
Link innerRef now supports React.createRef.
Route component now supports React.forwardRef.
A Route path can now be an array, allowing one route to render the same component for multiple paths.
Behavior and default changes 5
Support for React 16 is improved while maintaining compatibility with React >= 15.
React Router migrated to the new React context API and includes a polyfill for React versions below 16.2.
The react-router dependency in each react-router-dom release is pinned to prevent version mismatches.
Route supports multiple child nodes when using React 16.0 or later.
Using React 16's new context API avoids the update-blocking problem users may previously have had to work around.
Tooling 1
Pre-optimized production builds mean you no longer have to manually set process.env.NODE_ENV to production in your build script.
Fixes and other changes 3
Fixed Link behavior when target is set to _self.
Fixed the prop-type warning for the Route component prop when using forwardRef.
React Router eliminates its warnings in StrictMode.