Dev tools and CLI for React Router that enables framework features through bundler integration like server rendering, code splitting, HMR, etc.
npm install @react-router/dev --save-dev
v7.5.0
Date: 2025-04-04
What's Changed
route.lazy
Object API
We've introduced a new route.lazy
API which gives you more granular control over the lazy loading of route properties that you could not achieve with the route.lazy()
function signature. This is useful for Framework mode and performance-critical library mode applications.
createBrowserRouter([
{
path: "/show/:showId",
lazy: {
loader: async () => (await import("./show.loader.js")).loader,
action: async () => (await import("./show.action.js")).action,
Component: async () => (await import("./show.component.js")).Component,
},
},
]);
⚠️ This is a breaking change if you have adopted the route.unstable_lazyMiddleware
API which has been removed in favor of route.lazy.unstable_middleware
. See the Unstable Changes
section below for more information.
Minor Changes
react-router
- Add granular object-based API for route.lazy
to support lazy loading of individual route properties (#13294)
Patch Changes
@react-router/dev
- Update optional wrangler
peer dependency range to support wrangler
v4 (#13258)
@react-router/dev
- Reinstate dependency optimization in the child compiler to fix depsOptimizer is required in dev mode
errors when using vite-plugin-cloudflare
and importing Node.js builtins (#13317)
Unstable Changes
⚠️ Unstable features are not recommended for production use
react-router
- Introduce future.unstable_subResourceIntegrity
flag that enables generation of an importmap
with integrity
for the scripts that will be loaded by the browser (#13163)
react-router
- Remove support for the route.unstable_lazyMiddleware
property (#13294)
- In order to lazily load middleware, you can use the new object-based
route.lazy.unstable_middleware
API
@react-router/dev
- When future.unstable_viteEnvironmentApi
is enabled, ensure critical CSS in development works when using a custom Vite base
has been configured (#13305)
Changes by Package
Full Changelog: v7.4.1...v7.5.0