react-router 7.16.0 → 8.0.0-pre.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +0 -1
- package/dist/development/dom-export.d.ts +6 -172
- package/dist/development/dom-export.js +12 -1007
- package/dist/development/index-react-server-client.d.ts +7 -4
- package/dist/development/index-react-server-client.js +8 -52
- package/dist/development/index-react-server.d.ts +1645 -1635
- package/dist/development/index-react-server.js +2880 -3642
- package/dist/development/index.d.ts +43 -1475
- package/dist/development/index.js +37 -2621
- package/dist/development/lib/actions.js +62 -0
- package/dist/development/lib/components.d.ts +1022 -0
- package/dist/development/lib/components.js +835 -0
- package/dist/development/lib/context.d.ts +83 -0
- package/dist/development/lib/context.js +41 -0
- package/dist/development/lib/dom/dom.d.ts +119 -0
- package/dist/development/lib/dom/dom.js +143 -0
- package/dist/development/lib/dom/lib.d.ts +2042 -0
- package/dist/development/lib/dom/lib.js +1259 -0
- package/dist/development/lib/dom/server.d.ts +138 -0
- package/dist/development/lib/dom/server.js +301 -0
- package/dist/development/lib/dom/ssr/components.d.ts +196 -0
- package/dist/development/lib/dom/ssr/components.js +579 -0
- package/dist/development/lib/dom/ssr/data.js +29 -0
- package/dist/development/lib/dom/ssr/entry.d.ts +59 -0
- package/dist/development/lib/dom/ssr/errorBoundaries.d.ts +27 -0
- package/dist/development/lib/dom/ssr/errorBoundaries.js +83 -0
- package/dist/development/lib/dom/ssr/errors.d.ts +7 -0
- package/dist/development/lib/dom/ssr/errors.js +36 -0
- package/dist/development/lib/dom/ssr/fallback.js +28 -0
- package/dist/development/lib/dom/ssr/fog-of-war.d.ts +12 -0
- package/dist/development/lib/dom/ssr/fog-of-war.js +170 -0
- package/dist/development/lib/dom/ssr/hydration.d.ts +32 -0
- package/dist/development/lib/dom/ssr/hydration.js +29 -0
- package/dist/development/lib/dom/ssr/invariant.js +16 -0
- package/dist/development/lib/dom/ssr/links.js +170 -0
- package/dist/development/lib/dom/ssr/markup.js +24 -0
- package/dist/development/lib/dom/ssr/routeModules.d.ts +206 -0
- package/dist/development/lib/dom/ssr/routeModules.js +31 -0
- package/dist/development/lib/dom/ssr/routes-test-stub.d.ts +62 -0
- package/dist/development/lib/dom/ssr/routes-test-stub.js +108 -0
- package/dist/development/lib/dom/ssr/routes.d.ts +33 -0
- package/dist/development/lib/dom/ssr/routes.js +303 -0
- package/dist/development/lib/dom/ssr/server.d.ts +45 -0
- package/dist/development/lib/dom/ssr/server.js +68 -0
- package/dist/development/lib/dom/ssr/single-fetch.d.ts +14 -0
- package/dist/development/lib/dom/ssr/single-fetch.js +346 -0
- package/dist/development/lib/dom-export/dom-router-provider.d.ts +9 -0
- package/dist/development/lib/dom-export/dom-router-provider.js +22 -0
- package/dist/development/lib/dom-export/hydrated-router.d.ts +125 -0
- package/dist/development/lib/dom-export/hydrated-router.js +153 -0
- package/dist/development/lib/errors.js +29 -0
- package/dist/development/lib/hooks.d.ts +947 -0
- package/dist/development/lib/hooks.js +1386 -0
- package/dist/development/lib/href.d.ts +20 -0
- package/dist/development/lib/href.js +50 -0
- package/dist/development/lib/router/history.d.ts +258 -0
- package/dist/development/lib/router/history.js +371 -0
- package/dist/development/lib/router/instrumentation.d.ts +86 -0
- package/dist/development/lib/router/instrumentation.js +213 -0
- package/dist/development/lib/router/links.d.ts +113 -0
- package/dist/development/lib/router/router.d.ts +663 -0
- package/dist/development/lib/router/router.js +2981 -0
- package/dist/development/lib/router/utils.d.ts +942 -0
- package/dist/development/lib/router/utils.js +791 -0
- package/dist/development/lib/rsc/browser.d.ts +137 -0
- package/dist/development/lib/rsc/browser.js +599 -0
- package/dist/development/lib/rsc/errorBoundaries.d.ts +11 -0
- package/dist/development/lib/rsc/errorBoundaries.js +90 -0
- package/dist/development/lib/rsc/html-stream/browser.d.ts +48 -0
- package/dist/development/lib/rsc/html-stream/browser.js +74 -0
- package/dist/development/lib/rsc/html-stream/server.js +78 -0
- package/dist/development/lib/rsc/route-modules.js +27 -0
- package/dist/development/lib/rsc/server.rsc.d.ts +219 -0
- package/dist/development/lib/rsc/server.ssr.d.ts +129 -0
- package/dist/development/lib/rsc/server.ssr.js +388 -0
- package/dist/development/lib/server-runtime/build.d.ts +66 -0
- package/dist/development/lib/server-runtime/cookies.d.ts +66 -0
- package/dist/development/lib/server-runtime/cookies.js +139 -0
- package/dist/development/lib/server-runtime/crypto.js +43 -0
- package/dist/development/lib/server-runtime/data.d.ts +13 -0
- package/dist/development/lib/server-runtime/data.js +25 -0
- package/dist/development/lib/server-runtime/dev.d.ts +9 -0
- package/dist/development/lib/server-runtime/dev.js +26 -0
- package/dist/development/lib/server-runtime/entry.js +20 -0
- package/dist/development/lib/server-runtime/errors.js +95 -0
- package/dist/development/lib/server-runtime/headers.js +73 -0
- package/dist/development/lib/server-runtime/invariant.js +19 -0
- package/dist/development/lib/server-runtime/mode.d.ts +12 -0
- package/dist/development/lib/server-runtime/mode.js +25 -0
- package/dist/development/lib/server-runtime/routeMatching.js +28 -0
- package/dist/development/lib/server-runtime/routes.d.ts +13 -0
- package/dist/development/lib/server-runtime/routes.js +74 -0
- package/dist/development/lib/server-runtime/server.d.ts +10 -0
- package/dist/development/lib/server-runtime/server.js +351 -0
- package/dist/development/lib/server-runtime/serverHandoff.js +17 -0
- package/dist/development/lib/server-runtime/sessions/cookieStorage.d.ts +25 -0
- package/dist/development/lib/server-runtime/sessions/cookieStorage.js +45 -0
- package/dist/development/lib/server-runtime/sessions/memoryStorage.d.ts +23 -0
- package/dist/development/lib/server-runtime/sessions/memoryStorage.js +52 -0
- package/dist/development/lib/server-runtime/sessions.d.ts +145 -0
- package/dist/development/lib/server-runtime/sessions.js +98 -0
- package/dist/development/lib/server-runtime/single-fetch.d.ts +7 -0
- package/dist/development/lib/server-runtime/single-fetch.js +215 -0
- package/dist/development/lib/server-runtime/urls.js +31 -0
- package/dist/development/lib/server-runtime/warnings.js +20 -0
- package/dist/development/lib/types/future.d.ts +9 -0
- package/dist/development/lib/types/internal.d.ts +26 -177
- package/dist/development/lib/types/internal.js +3 -2
- package/dist/{production/register-CNAx3TXj.d.ts → development/lib/types/register.d.ts} +9 -15
- package/dist/development/lib/types/route-data.d.ts +113 -0
- package/dist/development/lib/types/route-module-annotations.d.ts +149 -0
- package/dist/development/lib/types/route-module.d.ts +19 -0
- package/dist/development/lib/types/serializes-to.d.ts +13 -0
- package/dist/development/lib/types/utils.d.ts +11 -0
- package/dist/development/vendor/turbo-stream-v2/flatten.js +159 -0
- package/dist/development/vendor/turbo-stream-v2/turbo-stream.js +178 -0
- package/dist/development/vendor/turbo-stream-v2/unflatten.js +198 -0
- package/dist/development/vendor/turbo-stream-v2/utils.js +47 -0
- package/dist/production/dom-export.d.ts +6 -172
- package/dist/production/dom-export.js +12 -1007
- package/dist/production/index-react-server-client.d.ts +7 -4
- package/dist/production/index-react-server-client.js +8 -52
- package/dist/production/index-react-server.d.ts +1645 -1635
- package/dist/production/index-react-server.js +2871 -3642
- package/dist/production/index.d.ts +43 -1475
- package/dist/production/index.js +37 -2621
- package/dist/production/lib/actions.js +62 -0
- package/dist/production/lib/components.d.ts +1022 -0
- package/dist/production/lib/components.js +835 -0
- package/dist/production/lib/context.d.ts +83 -0
- package/dist/production/lib/context.js +41 -0
- package/dist/production/lib/dom/dom.d.ts +119 -0
- package/dist/production/lib/dom/dom.js +143 -0
- package/dist/production/lib/dom/lib.d.ts +2042 -0
- package/dist/production/lib/dom/lib.js +1259 -0
- package/dist/production/lib/dom/server.d.ts +138 -0
- package/dist/production/lib/dom/server.js +301 -0
- package/dist/production/lib/dom/ssr/components.d.ts +196 -0
- package/dist/production/lib/dom/ssr/components.js +579 -0
- package/dist/production/lib/dom/ssr/data.js +29 -0
- package/dist/production/lib/dom/ssr/entry.d.ts +59 -0
- package/dist/production/lib/dom/ssr/errorBoundaries.d.ts +27 -0
- package/dist/production/lib/dom/ssr/errorBoundaries.js +83 -0
- package/dist/production/lib/dom/ssr/errors.d.ts +7 -0
- package/dist/production/lib/dom/ssr/errors.js +36 -0
- package/dist/production/lib/dom/ssr/fallback.js +21 -0
- package/dist/production/lib/dom/ssr/fog-of-war.d.ts +12 -0
- package/dist/production/lib/dom/ssr/fog-of-war.js +170 -0
- package/dist/production/lib/dom/ssr/hydration.d.ts +32 -0
- package/dist/production/lib/dom/ssr/hydration.js +29 -0
- package/dist/production/lib/dom/ssr/invariant.js +16 -0
- package/dist/production/lib/dom/ssr/links.js +170 -0
- package/dist/production/lib/dom/ssr/markup.js +24 -0
- package/dist/production/lib/dom/ssr/routeModules.d.ts +206 -0
- package/dist/production/lib/dom/ssr/routeModules.js +31 -0
- package/dist/production/lib/dom/ssr/routes-test-stub.d.ts +62 -0
- package/dist/production/lib/dom/ssr/routes-test-stub.js +108 -0
- package/dist/production/lib/dom/ssr/routes.d.ts +33 -0
- package/dist/production/lib/dom/ssr/routes.js +303 -0
- package/dist/production/lib/dom/ssr/server.d.ts +45 -0
- package/dist/production/lib/dom/ssr/server.js +68 -0
- package/dist/production/lib/dom/ssr/single-fetch.d.ts +14 -0
- package/dist/production/lib/dom/ssr/single-fetch.js +346 -0
- package/dist/production/lib/dom-export/dom-router-provider.d.ts +9 -0
- package/dist/production/lib/dom-export/dom-router-provider.js +22 -0
- package/dist/production/lib/dom-export/hydrated-router.d.ts +125 -0
- package/dist/production/lib/dom-export/hydrated-router.js +153 -0
- package/dist/production/lib/errors.js +29 -0
- package/dist/production/lib/hooks.d.ts +947 -0
- package/dist/production/lib/hooks.js +1371 -0
- package/dist/production/lib/href.d.ts +20 -0
- package/dist/production/lib/href.js +50 -0
- package/dist/production/lib/router/history.d.ts +258 -0
- package/dist/production/lib/router/history.js +371 -0
- package/dist/production/lib/router/instrumentation.d.ts +86 -0
- package/dist/production/lib/router/instrumentation.js +213 -0
- package/dist/production/lib/router/links.d.ts +113 -0
- package/dist/production/lib/router/router.d.ts +663 -0
- package/dist/production/lib/router/router.js +2981 -0
- package/dist/production/lib/router/utils.d.ts +942 -0
- package/dist/production/lib/router/utils.js +782 -0
- package/dist/production/lib/rsc/browser.d.ts +137 -0
- package/dist/production/lib/rsc/browser.js +599 -0
- package/dist/production/lib/rsc/errorBoundaries.d.ts +11 -0
- package/dist/production/lib/rsc/errorBoundaries.js +90 -0
- package/dist/production/lib/rsc/html-stream/browser.d.ts +48 -0
- package/dist/production/lib/rsc/html-stream/browser.js +74 -0
- package/dist/production/lib/rsc/html-stream/server.js +78 -0
- package/dist/production/lib/rsc/route-modules.js +27 -0
- package/dist/production/lib/rsc/server.rsc.d.ts +219 -0
- package/dist/production/lib/rsc/server.ssr.d.ts +129 -0
- package/dist/production/lib/rsc/server.ssr.js +388 -0
- package/dist/production/lib/server-runtime/build.d.ts +66 -0
- package/dist/production/lib/server-runtime/cookies.d.ts +66 -0
- package/dist/production/lib/server-runtime/cookies.js +139 -0
- package/dist/production/lib/server-runtime/crypto.js +43 -0
- package/dist/production/lib/server-runtime/data.d.ts +13 -0
- package/dist/production/lib/server-runtime/data.js +25 -0
- package/dist/production/lib/server-runtime/dev.d.ts +9 -0
- package/dist/production/lib/server-runtime/dev.js +26 -0
- package/dist/production/lib/server-runtime/entry.js +20 -0
- package/dist/production/lib/server-runtime/errors.js +95 -0
- package/dist/production/lib/server-runtime/headers.js +73 -0
- package/dist/production/lib/server-runtime/invariant.js +19 -0
- package/dist/production/lib/server-runtime/mode.d.ts +12 -0
- package/dist/production/lib/server-runtime/mode.js +25 -0
- package/dist/production/lib/server-runtime/routeMatching.js +28 -0
- package/dist/production/lib/server-runtime/routes.d.ts +13 -0
- package/dist/production/lib/server-runtime/routes.js +74 -0
- package/dist/production/lib/server-runtime/server.d.ts +10 -0
- package/dist/production/lib/server-runtime/server.js +351 -0
- package/dist/production/lib/server-runtime/serverHandoff.js +17 -0
- package/dist/production/lib/server-runtime/sessions/cookieStorage.d.ts +25 -0
- package/dist/production/lib/server-runtime/sessions/cookieStorage.js +45 -0
- package/dist/production/lib/server-runtime/sessions/memoryStorage.d.ts +23 -0
- package/dist/production/lib/server-runtime/sessions/memoryStorage.js +52 -0
- package/dist/production/lib/server-runtime/sessions.d.ts +145 -0
- package/dist/production/lib/server-runtime/sessions.js +98 -0
- package/dist/production/lib/server-runtime/single-fetch.d.ts +7 -0
- package/dist/production/lib/server-runtime/single-fetch.js +215 -0
- package/dist/production/lib/server-runtime/urls.js +31 -0
- package/dist/production/lib/server-runtime/warnings.js +20 -0
- package/dist/production/lib/types/future.d.ts +9 -0
- package/dist/production/lib/types/internal.d.ts +26 -177
- package/dist/production/lib/types/internal.js +3 -2
- package/dist/{development/register-CNAx3TXj.d.ts → production/lib/types/register.d.ts} +9 -15
- package/dist/production/lib/types/route-data.d.ts +113 -0
- package/dist/production/lib/types/route-module-annotations.d.ts +149 -0
- package/dist/production/lib/types/route-module.d.ts +19 -0
- package/dist/production/lib/types/serializes-to.d.ts +13 -0
- package/dist/production/lib/types/utils.d.ts +11 -0
- package/dist/production/vendor/turbo-stream-v2/flatten.js +159 -0
- package/dist/production/vendor/turbo-stream-v2/turbo-stream.js +178 -0
- package/dist/production/vendor/turbo-stream-v2/unflatten.js +198 -0
- package/dist/production/vendor/turbo-stream-v2/utils.js +47 -0
- package/docs/explanation/backend-for-frontend.md +50 -0
- package/docs/explanation/code-splitting.md +77 -0
- package/docs/explanation/concurrency.md +135 -0
- package/docs/explanation/form-vs-fetcher.md +292 -0
- package/docs/explanation/hot-module-replacement.md +137 -0
- package/docs/explanation/hydration.md +14 -0
- package/docs/explanation/index-query-param.md +86 -0
- package/docs/explanation/index.md +4 -0
- package/docs/explanation/lazy-route-discovery.md +78 -0
- package/docs/explanation/location.md +6 -0
- package/docs/explanation/progressive-enhancement.md +150 -0
- package/docs/explanation/race-conditions.md +88 -0
- package/docs/explanation/react-transitions.md +160 -0
- package/docs/explanation/route-matching.md +7 -0
- package/docs/explanation/server-client-execution.md +4 -0
- package/docs/explanation/sessions-and-cookies.md +465 -0
- package/docs/explanation/special-files.md +16 -0
- package/docs/explanation/state-management.md +524 -0
- package/docs/explanation/styling.md +87 -0
- package/docs/explanation/type-safety.md +82 -0
- package/docs/how-to/accessibility.md +44 -0
- package/docs/how-to/client-data.md +199 -0
- package/docs/how-to/data-strategy.md +317 -0
- package/docs/how-to/error-boundary.md +231 -0
- package/docs/how-to/error-reporting.md +134 -0
- package/docs/how-to/fetchers.md +307 -0
- package/docs/how-to/file-route-conventions.md +410 -0
- package/docs/how-to/file-uploads.md +217 -0
- package/docs/how-to/form-validation.md +120 -0
- package/docs/how-to/headers.md +164 -0
- package/docs/how-to/index.md +4 -0
- package/docs/how-to/instrumentation.md +556 -0
- package/docs/how-to/meta.md +40 -0
- package/docs/how-to/middleware.md +728 -0
- package/docs/how-to/navigation-blocking.md +233 -0
- package/docs/how-to/optimize-revalidation.md +12 -0
- package/docs/how-to/pre-rendering.md +225 -0
- package/docs/how-to/presets.md +103 -0
- package/docs/how-to/react-server-components.md +899 -0
- package/docs/how-to/resource-routes.md +126 -0
- package/docs/how-to/route-module-type-safety.md +100 -0
- package/docs/how-to/search-params.md +4 -0
- package/docs/how-to/security.md +30 -0
- package/docs/how-to/server-bundles.md +66 -0
- package/docs/how-to/spa.md +120 -0
- package/docs/how-to/status.md +63 -0
- package/docs/how-to/suspense.md +132 -0
- package/docs/how-to/using-handle.md +117 -0
- package/docs/how-to/view-transitions.md +237 -0
- package/docs/how-to/webhook.md +50 -0
- package/docs/index.md +39 -0
- package/docs/start/data/actions.md +138 -0
- package/docs/start/data/custom.md +198 -0
- package/docs/start/data/data-loading.md +44 -0
- package/docs/start/data/index.md +4 -0
- package/docs/start/data/installation.md +52 -0
- package/docs/start/data/navigating.md +12 -0
- package/docs/start/data/pending-ui.md +12 -0
- package/docs/start/data/route-object.md +248 -0
- package/docs/start/data/routing.md +281 -0
- package/docs/start/data/testing.md +8 -0
- package/docs/start/declarative/index.md +4 -0
- package/docs/start/declarative/installation.md +43 -0
- package/docs/start/declarative/navigating.md +133 -0
- package/docs/start/declarative/routing.md +237 -0
- package/docs/start/declarative/url-values.md +65 -0
- package/docs/start/framework/actions.md +175 -0
- package/docs/start/framework/data-loading.md +201 -0
- package/docs/start/framework/deploying.md +96 -0
- package/docs/start/framework/index.md +4 -0
- package/docs/start/framework/installation.md +42 -0
- package/docs/start/framework/navigating.md +182 -0
- package/docs/start/framework/pending-ui.md +142 -0
- package/docs/start/framework/rendering.md +59 -0
- package/docs/start/framework/route-module.md +527 -0
- package/docs/start/framework/routing.md +362 -0
- package/docs/start/framework/testing.md +133 -0
- package/docs/start/index.md +4 -0
- package/docs/start/modes.md +201 -0
- package/docs/upgrading/component-routes.md +363 -0
- package/docs/upgrading/future.md +31 -0
- package/docs/upgrading/index.md +4 -0
- package/docs/upgrading/remix.md +403 -0
- package/docs/upgrading/router-provider.md +442 -0
- package/docs/upgrading/v6.md +379 -0
- package/package.json +44 -87
- package/dist/development/browser-D3uq9sI1.d.ts +0 -318
- package/dist/development/browser-nIQ4Nsyi.d.mts +0 -318
- package/dist/development/chunk-IBI7OMNB.js +0 -1363
- package/dist/development/chunk-QUQL4437.mjs +0 -11529
- package/dist/development/chunk-S54KXAEJ.mjs +0 -2585
- package/dist/development/chunk-SRID2YZ2.js +0 -10229
- package/dist/development/chunk-XEJDWL2B.js +0 -188
- package/dist/development/context-m8rizgnE.d.mts +0 -1771
- package/dist/development/data-D4xhSy90.d.ts +0 -1732
- package/dist/development/data-U8FS-wNn.d.mts +0 -1732
- package/dist/development/dom-export.d.mts +0 -172
- package/dist/development/dom-export.mjs +0 -1008
- package/dist/development/index-react-server-client-BLiUx67a.d.ts +0 -3655
- package/dist/development/index-react-server-client-CdKROblb.d.mts +0 -2600
- package/dist/development/index-react-server-client.d.mts +0 -4
- package/dist/development/index-react-server-client.mjs +0 -59
- package/dist/development/index-react-server.d.mts +0 -2703
- package/dist/development/index-react-server.mjs +0 -3780
- package/dist/development/index.d.mts +0 -1478
- package/dist/development/index.mjs +0 -277
- package/dist/development/instrumentation-1q4YhLGP.d.ts +0 -715
- package/dist/development/lib/types/internal.d.mts +0 -184
- package/dist/development/lib/types/internal.mjs +0 -10
- package/dist/development/register-CqK96Zfk.d.mts +0 -30
- package/dist/production/browser-D3uq9sI1.d.ts +0 -318
- package/dist/production/browser-nIQ4Nsyi.d.mts +0 -318
- package/dist/production/chunk-EAQNHM3N.js +0 -188
- package/dist/production/chunk-NALGHHKE.mjs +0 -2585
- package/dist/production/chunk-Q65P7S7Y.mjs +0 -11529
- package/dist/production/chunk-SKEDDLRM.js +0 -1363
- package/dist/production/chunk-Y7DNFQZP.js +0 -10229
- package/dist/production/context-m8rizgnE.d.mts +0 -1771
- package/dist/production/data-D4xhSy90.d.ts +0 -1732
- package/dist/production/data-U8FS-wNn.d.mts +0 -1732
- package/dist/production/dom-export.d.mts +0 -172
- package/dist/production/dom-export.mjs +0 -1008
- package/dist/production/index-react-server-client-BLiUx67a.d.ts +0 -3655
- package/dist/production/index-react-server-client-CdKROblb.d.mts +0 -2600
- package/dist/production/index-react-server-client.d.mts +0 -4
- package/dist/production/index-react-server-client.mjs +0 -59
- package/dist/production/index-react-server.d.mts +0 -2703
- package/dist/production/index-react-server.mjs +0 -3780
- package/dist/production/index.d.mts +0 -1478
- package/dist/production/index.mjs +0 -277
- package/dist/production/instrumentation-1q4YhLGP.d.ts +0 -715
- package/dist/production/lib/types/internal.d.mts +0 -184
- package/dist/production/lib/types/internal.mjs +0 -10
- package/dist/production/register-CqK96Zfk.d.mts +0 -30
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Upgrading from Remix
|
|
3
|
+
order: 3
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Upgrading from Remix
|
|
7
|
+
|
|
8
|
+
<docs-info>
|
|
9
|
+
|
|
10
|
+
React Router v7 requires the following minimum versions:
|
|
11
|
+
|
|
12
|
+
- `node@20`
|
|
13
|
+
- `react@18`
|
|
14
|
+
- `react-dom@18`
|
|
15
|
+
|
|
16
|
+
</docs-info>
|
|
17
|
+
|
|
18
|
+
React Router v7 is the next major version of Remix after v2 (see our ["Incremental Path to React 19" blog post][incremental-path-to-react-19] for more information).
|
|
19
|
+
|
|
20
|
+
If you have enabled all [Remix v2 future flags][v2-future-flags], upgrading from Remix v2 to React Router v7 mainly involves updating dependencies.
|
|
21
|
+
|
|
22
|
+
<docs-info>
|
|
23
|
+
|
|
24
|
+
The majority of steps 2-8 can be automatically updated using a [codemod][codemod] created by community member [James Restall][jrestall].
|
|
25
|
+
|
|
26
|
+
</docs-info>
|
|
27
|
+
|
|
28
|
+
## 1. Adopt future flags
|
|
29
|
+
|
|
30
|
+
**👉 Adopt future flags**
|
|
31
|
+
|
|
32
|
+
Adopt all existing [future flags][v2-future-flags] in your Remix v2 application.
|
|
33
|
+
|
|
34
|
+
## 2. Update dependencies
|
|
35
|
+
|
|
36
|
+
Most of the "shared" APIs that used to be re-exported through the runtime-specific packages (`@remix-run/node`, `@remix-run/cloudflare`, etc.) have all been collapsed into `react-router` in v7. So instead of importing from `@react-router/node` or `@react-router/cloudflare`, you'll import those directly from `react-router`.
|
|
37
|
+
|
|
38
|
+
```diff
|
|
39
|
+
-import { redirect } from "@remix-run/node";
|
|
40
|
+
+import { redirect } from "react-router";
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
The only APIs you should be importing from the runtime-specific packages in v7 are APIs that are specific to that runtime, such as `createFileSessionStorage` for Node and `createWorkersKVSessionStorage` for Cloudflare.
|
|
44
|
+
|
|
45
|
+
**👉 Run the codemod (automated)**
|
|
46
|
+
|
|
47
|
+
You can automatically update your packages and imports with the following [codemod][codemod]. This codemod updates all of your packages and imports. Be sure to commit any pending changes before running the codemod, in case you need to revert.
|
|
48
|
+
|
|
49
|
+
```shellscript nonumber
|
|
50
|
+
npx codemod remix/2/react-router/upgrade
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**👉 Install the new dependencies**
|
|
54
|
+
|
|
55
|
+
After the codemod updates your dependencies, you need to install the dependencies to remove Remix packages and add the new React Router packages.
|
|
56
|
+
|
|
57
|
+
```shellscript nonumber
|
|
58
|
+
npm install
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**👉 Update your dependencies (manual)**
|
|
62
|
+
|
|
63
|
+
If you prefer not to use the codemod, you can manually update your dependencies.
|
|
64
|
+
|
|
65
|
+
<details>
|
|
66
|
+
<summary>Expand to see a table of package name changes in alphabetical order</summary>
|
|
67
|
+
|
|
68
|
+
| Remix v2 Package | | React Router v7 Package |
|
|
69
|
+
| ---------------------------------- | --- | ------------------------------------------- |
|
|
70
|
+
| `@remix-run/architect` | ➡️ | `@react-router/architect` |
|
|
71
|
+
| `@remix-run/cloudflare` | ➡️ | `@react-router/cloudflare` |
|
|
72
|
+
| `@remix-run/dev` | ➡️ | `@react-router/dev` |
|
|
73
|
+
| `@remix-run/express` | ➡️ | `@react-router/express` |
|
|
74
|
+
| `@remix-run/fs-routes` | ➡️ | `@react-router/fs-routes` |
|
|
75
|
+
| `@remix-run/node` | ➡️ | `@react-router/node` |
|
|
76
|
+
| `@remix-run/react` | ➡️ | `react-router` |
|
|
77
|
+
| `@remix-run/route-config` | ➡️ | `@react-router/dev` |
|
|
78
|
+
| `@remix-run/routes-option-adapter` | ➡️ | `@react-router/remix-routes-option-adapter` |
|
|
79
|
+
| `@remix-run/serve` | ➡️ | `@react-router/serve` |
|
|
80
|
+
| `@remix-run/server-runtime` | ➡️ | `react-router` |
|
|
81
|
+
| `@remix-run/testing` | ➡️ | `react-router` |
|
|
82
|
+
|
|
83
|
+
</details>
|
|
84
|
+
|
|
85
|
+
## 3. Change `scripts` in `package.json`
|
|
86
|
+
|
|
87
|
+
<docs-info>
|
|
88
|
+
|
|
89
|
+
If you used the codemod you can skip this step as it was automatically completed.
|
|
90
|
+
|
|
91
|
+
</docs-info>
|
|
92
|
+
|
|
93
|
+
**👉 Update the scripts in your `package.json`**
|
|
94
|
+
|
|
95
|
+
| Script | Remix v2 | | React Router v7 |
|
|
96
|
+
| ----------- | ----------------------------------- | --- | ------------------------------------------ |
|
|
97
|
+
| `dev` | `remix vite:dev` | ➡️ | `react-router dev` |
|
|
98
|
+
| `build` | `remix vite:build` | ➡️ | `react-router build` |
|
|
99
|
+
| `start` | `remix-serve build/server/index.js` | ➡️ | `react-router-serve build/server/index.js` |
|
|
100
|
+
| `typecheck` | `tsc` | ➡️ | `react-router typegen && tsc` |
|
|
101
|
+
|
|
102
|
+
## 4. Add a `routes.ts` file
|
|
103
|
+
|
|
104
|
+
<docs-info>
|
|
105
|
+
|
|
106
|
+
If you used the codemod _and_ Remix v2 `v3_routeConfig` flag, you can skip this step as it was automatically completed.
|
|
107
|
+
|
|
108
|
+
</docs-info>
|
|
109
|
+
|
|
110
|
+
In React Router v7 you define your routes using the `app/routes.ts` file. View the [routing documentation][routing] for more information.
|
|
111
|
+
|
|
112
|
+
**👉 Update dependencies (if using Remix v2 `v3_routeConfig` flag)**
|
|
113
|
+
|
|
114
|
+
```diff filename=app/routes.ts
|
|
115
|
+
-import { type RouteConfig } from "@remix-run/route-config";
|
|
116
|
+
-import { flatRoutes } from "@remix-run/fs-routes";
|
|
117
|
+
-import { remixRoutesOptionAdapter } from "@remix-run/routes-option-adapter";
|
|
118
|
+
+import { type RouteConfig } from "@react-router/dev/routes";
|
|
119
|
+
+import { flatRoutes } from "@react-router/fs-routes";
|
|
120
|
+
+import { remixRoutesOptionAdapter } from "@react-router/remix-routes-option-adapter";
|
|
121
|
+
|
|
122
|
+
export default [
|
|
123
|
+
// however your routes are defined
|
|
124
|
+
] satisfies RouteConfig;
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
**👉 Add a `routes.ts` file (if _not_ using Remix v2 `v3_routeConfig` flag)**
|
|
128
|
+
|
|
129
|
+
```shellscript nonumber
|
|
130
|
+
touch app/routes.ts
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
For backwards-compatibility, there are a few ways to adopt `routes.ts` to align with your route setup in Remix v2:
|
|
134
|
+
|
|
135
|
+
1. If you were using the "flat routes" [file-based convention][fs-routing], you can continue to use that via the new `@react-router/fs-routes` package:
|
|
136
|
+
|
|
137
|
+
```ts filename=app/routes.ts
|
|
138
|
+
import { type RouteConfig } from "@react-router/dev/routes";
|
|
139
|
+
import { flatRoutes } from "@react-router/fs-routes";
|
|
140
|
+
|
|
141
|
+
export default flatRoutes() satisfies RouteConfig;
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
2. If you were using the "nested" convention from Remix v1 via the `@remix-run/v1-route-convention` package, you can continue using that as well in conjunction with `@react-router/remix-routes-option-adapter`:
|
|
145
|
+
|
|
146
|
+
```ts filename=app/routes.ts
|
|
147
|
+
import { type RouteConfig } from "@react-router/dev/routes";
|
|
148
|
+
import { remixRoutesOptionAdapter } from "@react-router/remix-routes-option-adapter";
|
|
149
|
+
import { createRoutesFromFolders } from "@remix-run/v1-route-convention";
|
|
150
|
+
|
|
151
|
+
export default remixRoutesOptionAdapter(
|
|
152
|
+
createRoutesFromFolders,
|
|
153
|
+
) satisfies RouteConfig;
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
3. If you were using the `routes` option to define config-based routes, you can keep that config via `@react-router/remix-routes-option-adapter`:
|
|
157
|
+
|
|
158
|
+
```ts filename=app/routes.ts
|
|
159
|
+
import { type RouteConfig } from "@react-router/dev/routes";
|
|
160
|
+
import { remixRoutesOptionAdapter } from "@react-router/remix-routes-option-adapter";
|
|
161
|
+
|
|
162
|
+
export default remixRoutesOptionAdapter(
|
|
163
|
+
(defineRoutes) => {
|
|
164
|
+
return defineRoutes((route) => {
|
|
165
|
+
route("/", "home/route.tsx", { index: true });
|
|
166
|
+
route("about", "about/route.tsx");
|
|
167
|
+
route("", "concerts/layout.tsx", () => {
|
|
168
|
+
route("trending", "concerts/trending.tsx");
|
|
169
|
+
route(":city", "concerts/city.tsx");
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
},
|
|
173
|
+
) satisfies RouteConfig;
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
- Be sure to also remove the `routes` option in your `vite.config.ts`:
|
|
177
|
+
|
|
178
|
+
```diff filename=vite.config.ts
|
|
179
|
+
export default defineConfig({
|
|
180
|
+
plugins: [
|
|
181
|
+
remix({
|
|
182
|
+
ssr: true,
|
|
183
|
+
- ignoredRouteFiles: ['**/*'],
|
|
184
|
+
- routes(defineRoutes) {
|
|
185
|
+
- return defineRoutes((route) => {
|
|
186
|
+
- route("/somewhere/cool/*", "catchall.tsx");
|
|
187
|
+
- });
|
|
188
|
+
- },
|
|
189
|
+
})
|
|
190
|
+
tsconfigPaths(),
|
|
191
|
+
],
|
|
192
|
+
});
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## 5. Add a React Router config
|
|
196
|
+
|
|
197
|
+
**👉 Add `react-router.config.ts` your project**
|
|
198
|
+
|
|
199
|
+
The config that was previously passed to the `remix` plugin in `vite.config.ts` is now exported from `react-router.config.ts`.
|
|
200
|
+
|
|
201
|
+
Note: At this point you should remove the v3 future flags you added in step 1.
|
|
202
|
+
|
|
203
|
+
```shellscript nonumber
|
|
204
|
+
touch react-router.config.ts
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
```diff filename=vite.config.ts
|
|
208
|
+
export default defineConfig({
|
|
209
|
+
plugins: [
|
|
210
|
+
- remix({
|
|
211
|
+
- ssr: true,
|
|
212
|
+
- future: {/* all the v3 flags */}
|
|
213
|
+
- }),
|
|
214
|
+
+ reactRouter(),
|
|
215
|
+
tsconfigPaths(),
|
|
216
|
+
],
|
|
217
|
+
});
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
```diff filename=react-router.config.ts
|
|
221
|
+
+import type { Config } from "@react-router/dev/config";
|
|
222
|
+
+export default {
|
|
223
|
+
+ ssr: true,
|
|
224
|
+
+} satisfies Config;
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
## 6. Add React Router plugin to `vite.config`
|
|
228
|
+
|
|
229
|
+
<docs-info>
|
|
230
|
+
|
|
231
|
+
If you used the codemod you can skip this step as it was automatically completed.
|
|
232
|
+
|
|
233
|
+
</docs-info>
|
|
234
|
+
|
|
235
|
+
**👉 Add `reactRouter` plugin to `vite.config`**
|
|
236
|
+
|
|
237
|
+
Change `vite.config.ts` to import and use the new `reactRouter` plugin from `@react-router/dev/vite`:
|
|
238
|
+
|
|
239
|
+
```diff filename=vite.config.ts
|
|
240
|
+
-import { vitePlugin as remix } from "@remix-run/dev";
|
|
241
|
+
+import { reactRouter } from "@react-router/dev/vite";
|
|
242
|
+
import { defineConfig } from "vite";
|
|
243
|
+
import tsconfigPaths from "vite-tsconfig-paths";
|
|
244
|
+
|
|
245
|
+
export default defineConfig({
|
|
246
|
+
plugins: [
|
|
247
|
+
- remix(),
|
|
248
|
+
+ reactRouter(),
|
|
249
|
+
tsconfigPaths(),
|
|
250
|
+
],
|
|
251
|
+
});
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
## 7. Enable type safety
|
|
255
|
+
|
|
256
|
+
<docs-info>
|
|
257
|
+
|
|
258
|
+
If you are not using TypeScript, you can skip this step.
|
|
259
|
+
|
|
260
|
+
</docs-info>
|
|
261
|
+
|
|
262
|
+
React Router automatically generates types for your route modules into a `.react-router/` directory at the root of your app. This directory is fully managed by React Router and should be gitignore'd. Learn more about the [new type safety features][type-safety].
|
|
263
|
+
|
|
264
|
+
**👉 Add `.react-router/` to `.gitignore`**
|
|
265
|
+
|
|
266
|
+
```txt
|
|
267
|
+
.react-router/
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
**👉 Update `tsconfig.json`**
|
|
271
|
+
|
|
272
|
+
Update the `types` field in your `tsconfig.json` to include:
|
|
273
|
+
|
|
274
|
+
- `.react-router/types/**/*` path in the `include` field
|
|
275
|
+
- The appropriate `@react-router/*` package in the `types` field
|
|
276
|
+
- `rootDirs` for simplified relative imports
|
|
277
|
+
|
|
278
|
+
```diff filename=tsconfig.json
|
|
279
|
+
{
|
|
280
|
+
"include": [
|
|
281
|
+
/* ... */
|
|
282
|
+
+ ".react-router/types/**/*"
|
|
283
|
+
],
|
|
284
|
+
"compilerOptions": {
|
|
285
|
+
- "types": ["@remix-run/node", "vite/client"],
|
|
286
|
+
+ "types": ["@react-router/node", "vite/client"],
|
|
287
|
+
/* ... */
|
|
288
|
+
+ "rootDirs": [".", "./.react-router/types"]
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
## 8. Rename components in entry files
|
|
294
|
+
|
|
295
|
+
<docs-info>
|
|
296
|
+
|
|
297
|
+
If you used the codemod you can skip this step as it was automatically completed.
|
|
298
|
+
|
|
299
|
+
</docs-info>
|
|
300
|
+
|
|
301
|
+
If you have an `entry.server.tsx` and/or an `entry.client.tsx` file in your application, you will need to update the main components in these files:
|
|
302
|
+
|
|
303
|
+
```diff filename=app/entry.server.tsx
|
|
304
|
+
-import { RemixServer } from "@remix-run/react";
|
|
305
|
+
+import { ServerRouter } from "react-router";
|
|
306
|
+
|
|
307
|
+
-<RemixServer context={remixContext} url={request.url} />,
|
|
308
|
+
+<ServerRouter context={remixContext} url={request.url} />,
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
```diff filename=app/entry.client.tsx
|
|
312
|
+
-import { RemixBrowser } from "@remix-run/react";
|
|
313
|
+
+import { HydratedRouter } from "react-router/dom";
|
|
314
|
+
|
|
315
|
+
hydrateRoot(
|
|
316
|
+
document,
|
|
317
|
+
<StrictMode>
|
|
318
|
+
- <RemixBrowser />
|
|
319
|
+
+ <HydratedRouter />
|
|
320
|
+
</StrictMode>,
|
|
321
|
+
);
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
## 9. Update types for `AppLoadContext`
|
|
325
|
+
|
|
326
|
+
<docs-info>
|
|
327
|
+
|
|
328
|
+
If you were using `remix-serve` you can skip this step. This is only applicable if you were using a custom server in Remix v2.
|
|
329
|
+
|
|
330
|
+
</docs-info>
|
|
331
|
+
|
|
332
|
+
Since React Router can be used as both a React framework _and_ a stand-alone routing library, the `context` argument for `LoaderFunctionArgs` and `ActionFunctionArgs` is now optional and typed as `any` by default. You can register types for your load context to get type safety for your loaders and actions.
|
|
333
|
+
|
|
334
|
+
👉 **Register types for your load context**
|
|
335
|
+
|
|
336
|
+
Before you migrate to the new `Route.LoaderArgs` and `Route.ActionArgs` types, you can temporarily augment `LoaderFunctionArgs` and `ActionFunctionArgs` with your load context type to ease migration.
|
|
337
|
+
|
|
338
|
+
```ts filename=app/env.ts
|
|
339
|
+
declare module "react-router" {
|
|
340
|
+
// Your AppLoadContext used in v2
|
|
341
|
+
interface AppLoadContext {
|
|
342
|
+
whatever: string;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
// TODO: remove this once we've migrated to `Route.LoaderArgs` instead for our loaders
|
|
346
|
+
interface LoaderFunctionArgs {
|
|
347
|
+
context: AppLoadContext;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
// TODO: remove this once we've migrated to `Route.ActionArgs` instead for our actions
|
|
351
|
+
interface ActionFunctionArgs {
|
|
352
|
+
context: AppLoadContext;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
export {}; // necessary for TS to treat this as a module
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
<docs-info>
|
|
360
|
+
|
|
361
|
+
Using `declare module` to register types is a standard TypeScript technique called [module augmentation][ts-module-augmentation].
|
|
362
|
+
You can do this in any TypeScript file covered by your `tsconfig.json`'s `include` field, but we recommend a dedicated `env.ts` within your app directory.
|
|
363
|
+
|
|
364
|
+
</docs-info>
|
|
365
|
+
|
|
366
|
+
👉 **Use the new types**
|
|
367
|
+
|
|
368
|
+
Once you adopt the [new type generation][type-safety], you can remove the `LoaderFunctionArgs`/`ActionFunctionArgs` augmentations and use the `context` argument from [`Route.LoaderArgs`][server-loaders] and [`Route.ActionArgs`][server-actions] instead.
|
|
369
|
+
|
|
370
|
+
```ts filename=app/env.ts
|
|
371
|
+
declare module "react-router" {
|
|
372
|
+
// Your AppLoadContext used in v2
|
|
373
|
+
interface AppLoadContext {
|
|
374
|
+
whatever: string;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
export {}; // necessary for TS to treat this as a module
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
```ts filename=app/routes/my-route.tsx
|
|
382
|
+
import type { Route } from "./+types/my-route";
|
|
383
|
+
|
|
384
|
+
export function loader({ context }: Route.LoaderArgs) {}
|
|
385
|
+
// { whatever: string } ^^^^^^^
|
|
386
|
+
|
|
387
|
+
export function action({ context }: Route.ActionArgs) {}
|
|
388
|
+
// { whatever: string } ^^^^^^^
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
Congratulations! You are now on React Router v7. Go ahead and run your application to make sure everything is working as expected.
|
|
392
|
+
|
|
393
|
+
[incremental-path-to-react-19]: https://remix.run/blog/incremental-path-to-react-19
|
|
394
|
+
[v2-future-flags]: https://remix.run/docs/start/future-flags
|
|
395
|
+
[routing]: ../start/framework/routing
|
|
396
|
+
[fs-routing]: ../how-to/file-route-conventions
|
|
397
|
+
[v7-changelog-types]: https://github.com/remix-run/react-router/blob/release-next/CHANGELOG.md#type-safety-improvements
|
|
398
|
+
[server-loaders]: ../start/framework/data-loading#server-data-loading
|
|
399
|
+
[server-actions]: ../start/framework/actions#server-actions
|
|
400
|
+
[ts-module-augmentation]: https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation
|
|
401
|
+
[type-safety]: ../explanation/type-safety
|
|
402
|
+
[codemod]: https://app.codemod.com/registry/remix/2/react-router/upgrade
|
|
403
|
+
[jrestall]: https://github.com/jrestall
|