| 1 | # `react-router`
|
| 2 |
|
| 3 | ## 6.19.0
|
| 4 |
|
| 5 | ### Minor Changes
|
| 6 |
|
| 7 | - Add `unstable_flushSync` option to `useNavigate`/`useSumbit`/`fetcher.load`/`fetcher.submit` to opt-out of `React.startTransition` and into `ReactDOM.flushSync` for state updates ([#11005](https://github.com/remix-run/react-router/pull/11005))
|
| 8 | - Remove the `unstable_` prefix from the [`useBlocker`](https://reactrouter.com/en/main/hooks/use-blocker) hook as it's been in use for enough time that we are confident in the API. We do not plan to remove the prefix from `unstable_usePrompt` due to differences in how browsers handle `window.confirm` that prevent React Router from guaranteeing consistent/correct behavior. ([#10991](https://github.com/remix-run/react-router/pull/10991))
|
| 9 |
|
| 10 | ### Patch Changes
|
| 11 |
|
| 12 | - Fix `useActionData` so it returns proper contextual action data and not _any_ action data in the tree ([#11023](https://github.com/remix-run/react-router/pull/11023))
|
| 13 | - Fix bug in `useResolvedPath` that would cause `useResolvedPath(".")` in a splat route to lose the splat portion of the URL path. ([#10983](https://github.com/remix-run/react-router/pull/10983))
|
| 14 |
|
| 15 | - ⚠️ This fixes a quite long-standing bug specifically for `"."` paths inside a splat route which incorrectly dropped the splat portion of the URL. If you are relative routing via `"."` inside a splat route in your application you should double check that your logic is not relying on this buggy behavior and update accordingly.
|
| 16 |
|
| 17 | - Updated dependencies:
|
| 18 | - `@remix-run/router@1.12.0`
|
| 19 |
|
| 20 | ## 6.18.0
|
| 21 |
|
| 22 | ### Patch Changes
|
| 23 |
|
| 24 | - Fix the `future` prop on `BrowserRouter`, `HashRouter` and `MemoryRouter` so that it accepts a `Partial<FutureConfig>` instead of requiring all flags to be included. ([#10962](https://github.com/remix-run/react-router/pull/10962))
|
| 25 | - Updated dependencies:
|
| 26 | - `@remix-run/router@1.11.0`
|
| 27 |
|
| 28 | ## 6.17.0
|
| 29 |
|
| 30 | ### Patch Changes
|
| 31 |
|
| 32 | - Fix `RouterProvider` `future` prop type to be a `Partial<FutureConfig>` so that not all flags must be specified ([#10900](https://github.com/remix-run/react-router/pull/10900))
|
| 33 | - Updated dependencies:
|
| 34 | - `@remix-run/router@1.10.0`
|
| 35 |
|
| 36 | ## 6.16.0
|
| 37 |
|
| 38 | ### Minor Changes
|
| 39 |
|
| 40 | - In order to move towards stricter TypeScript support in the future, we're aiming to replace current usages of `any` with `unknown` on exposed typings for user-provided data. To do this in Remix v2 without introducing breaking changes in React Router v6, we have added generics to a number of shared types. These continue to default to `any` in React Router and are overridden with `unknown` in Remix. In React Router v7 we plan to move these to `unknown` as a breaking change. ([#10843](https://github.com/remix-run/react-router/pull/10843))
|
| 41 | - `Location` now accepts a generic for the `location.state` value
|
| 42 | - `ActionFunctionArgs`/`ActionFunction`/`LoaderFunctionArgs`/`LoaderFunction` now accept a generic for the `context` parameter (only used in SSR usages via `createStaticHandler`)
|
| 43 | - The return type of `useMatches` (now exported as `UIMatch`) accepts generics for `match.data` and `match.handle` - both of which were already set to `unknown`
|
| 44 | - Move the `@private` class export `ErrorResponse` to an `UNSAFE_ErrorResponseImpl` export since it is an implementation detail and there should be no construction of `ErrorResponse` instances in userland. This frees us up to export a `type ErrorResponse` which correlates to an instance of the class via `InstanceType`. Userland code should only ever be using `ErrorResponse` as a type and should be type-narrowing via `isRouteErrorResponse`. ([#10811](https://github.com/remix-run/react-router/pull/10811))
|
| 45 | - Export `ShouldRevalidateFunctionArgs` interface ([#10797](https://github.com/remix-run/react-router/pull/10797))
|
| 46 | - Removed private/internal APIs only required for the Remix v1 backwards compatibility layer and no longer needed in Remix v2 (`_isFetchActionRedirect`, `_hasFetcherDoneAnything`) ([#10715](https://github.com/remix-run/react-router/pull/10715))
|
| 47 |
|
| 48 | ### Patch Changes
|
| 49 |
|
| 50 | - Updated dependencies:
|
| 51 | - `@remix-run/router@1.9.0`
|
| 52 |
|
| 53 | ## 6.15.0
|
| 54 |
|
| 55 | ### Minor Changes
|
| 56 |
|
| 57 | - Add's a new `redirectDocument()` function which allows users to specify that a redirect from a `loader`/`action` should trigger a document reload (via `window.location`) instead of attempting to navigate to the redirected location via React Router ([#10705](https://github.com/remix-run/react-router/pull/10705))
|
| 58 |
|
| 59 | ### Patch Changes
|
| 60 |
|
| 61 | - Ensure `useRevalidator` is referentially stable across re-renders if revalidations are not actively occurring ([#10707](https://github.com/remix-run/react-router/pull/10707))
|
| 62 | - Updated dependencies:
|
| 63 | - `@remix-run/router@1.8.0`
|
| 64 |
|
| 65 | ## 6.14.2
|
| 66 |
|
| 67 | ### Patch Changes
|
| 68 |
|
| 69 | - Updated dependencies:
|
| 70 | - `@remix-run/router@1.7.2`
|
| 71 |
|
| 72 | ## 6.14.1
|
| 73 |
|
| 74 | ### Patch Changes
|
| 75 |
|
| 76 | - Fix loop in `unstable_useBlocker` when used with an unstable blocker function ([#10652](https://github.com/remix-run/react-router/pull/10652))
|
| 77 | - Fix issues with reused blockers on subsequent navigations ([#10656](https://github.com/remix-run/react-router/pull/10656))
|
| 78 | - Updated dependencies:
|
| 79 | - `@remix-run/router@1.7.1`
|
| 80 |
|
| 81 | ## 6.14.0
|
| 82 |
|
| 83 | ### Patch Changes
|
| 84 |
|
| 85 | - Strip `basename` from locations provided to `unstable_useBlocker` functions to match `useLocation` ([#10573](https://github.com/remix-run/react-router/pull/10573))
|
| 86 | - Fix `generatePath` when passed a numeric `0` value parameter ([#10612](https://github.com/remix-run/react-router/pull/10612))
|
| 87 | - Fix `unstable_useBlocker` key issues in `StrictMode` ([#10573](https://github.com/remix-run/react-router/pull/10573))
|
| 88 | - Fix `tsc --skipLibCheck:false` issues on React 17 ([#10622](https://github.com/remix-run/react-router/pull/10622))
|
| 89 | - Upgrade `typescript` to 5.1 ([#10581](https://github.com/remix-run/react-router/pull/10581))
|
| 90 | - Updated dependencies:
|
| 91 | - `@remix-run/router@1.7.0`
|
| 92 |
|
| 93 | ## 6.13.0
|
| 94 |
|
| 95 | ### Minor Changes
|
| 96 |
|
| 97 | - Move [`React.startTransition`](https://react.dev/reference/react/startTransition) usage behind a [future flag](https://reactrouter.com/en/main/guides/api-development-strategy) to avoid issues with existing incompatible `Suspense` usages. We recommend folks adopting this flag to be better compatible with React concurrent mode, but if you run into issues you can continue without the use of `startTransition` until v7. Issues usually boils down to creating net-new promises during the render cycle, so if you run into issues you should either lift your promise creation out of the render cycle or put it behind a `useMemo`. ([#10596](https://github.com/remix-run/react-router/pull/10596))
|
| 98 |
|
| 99 | Existing behavior will no longer include `React.startTransition`:
|
| 100 |
|
| 101 | ```jsx
|
| 102 | <BrowserRouter>
|
| 103 | <Routes>{/*...*/}</Routes>
|
| 104 | </BrowserRouter>
|
| 105 |
|
| 106 | <RouterProvider router={router} />
|
| 107 | ```
|
| 108 |
|
| 109 | If you wish to enable `React.startTransition`, pass the future flag to your component:
|
| 110 |
|
| 111 | ```jsx
|
| 112 | <BrowserRouter future={{ v7_startTransition: true }}>
|
| 113 | <Routes>{/*...*/}</Routes>
|
| 114 | </BrowserRouter>
|
| 115 |
|
| 116 | <RouterProvider router={router} future={{ v7_startTransition: true }}/>
|
| 117 | ```
|
| 118 |
|
| 119 | ### Patch Changes
|
| 120 |
|
| 121 | - Work around webpack/terser `React.startTransition` minification bug in production mode ([#10588](https://github.com/remix-run/react-router/pull/10588))
|
| 122 |
|
| 123 | ## 6.12.1
|
| 124 |
|
| 125 | > **Warning**
|
| 126 | > Please use version `6.13.0` or later instead of `6.12.1`. This version suffers from a `webpack`/`terser` minification issue resulting in invalid minified code in your resulting production bundles which can cause issues in your application. See [#10579](https://github.com/remix-run/react-router/issues/10579) for more details.
|
| 127 |
|
| 128 | ### Patch Changes
|
| 129 |
|
| 130 | - Adjust feature detection of `React.startTransition` to fix webpack + react 17 compilation error ([#10569](https://github.com/remix-run/react-router/pull/10569))
|
| 131 |
|
| 132 | ## 6.12.0
|
| 133 |
|
| 134 | ### Minor Changes
|
| 135 |
|
| 136 | - Wrap internal router state updates with `React.startTransition` if it exists ([#10438](https://github.com/remix-run/react-router/pull/10438))
|
| 137 |
|
| 138 | ### Patch Changes
|
| 139 |
|
| 140 | - Updated dependencies:
|
| 141 | - `@remix-run/router@1.6.3`
|
| 142 |
|
| 143 | ## 6.11.2
|
| 144 |
|
| 145 | ### Patch Changes
|
| 146 |
|
| 147 | - Fix `basename` duplication in descendant `<Routes>` inside a `<RouterProvider>` ([#10492](https://github.com/remix-run/react-router/pull/10492))
|
| 148 | - Updated dependencies:
|
| 149 | - `@remix-run/router@1.6.2`
|
| 150 |
|
| 151 | ## 6.11.1
|
| 152 |
|
| 153 | ### Patch Changes
|
| 154 |
|
| 155 | - Fix usage of `Component` API within descendant `<Routes>` ([#10434](https://github.com/remix-run/react-router/pull/10434))
|
| 156 | - Fix bug when calling `useNavigate` from `<Routes>` inside a `<RouterProvider>` ([#10432](https://github.com/remix-run/react-router/pull/10432))
|
| 157 | - Fix usage of `<Navigate>` in strict mode when using a data router ([#10435](https://github.com/remix-run/react-router/pull/10435))
|
| 158 | - Updated dependencies:
|
| 159 | - `@remix-run/router@1.6.1`
|
| 160 |
|
| 161 | ## 6.11.0
|
| 162 |
|
| 163 | ### Patch Changes
|
| 164 |
|
| 165 | - Log loader/action errors to the console in dev for easier stack trace evaluation ([#10286](https://github.com/remix-run/react-router/pull/10286))
|
| 166 | - Fix bug preventing rendering of descendant `<Routes>` when `RouterProvider` errors existed ([#10374](https://github.com/remix-run/react-router/pull/10374))
|
| 167 | - Fix inadvertent re-renders when using `Component` instead of `element` on a route definition ([#10287](https://github.com/remix-run/react-router/pull/10287))
|
| 168 | - Fix detection of `useNavigate` in the render cycle by setting the `activeRef` in a layout effect, allowing the `navigate` function to be passed to child components and called in a `useEffect` there. ([#10394](https://github.com/remix-run/react-router/pull/10394))
|
| 169 | - Switched from `useSyncExternalStore` to `useState` for internal `@remix-run/router` router state syncing in `<RouterProvider>`. We found some [subtle bugs](https://codesandbox.io/s/use-sync-external-store-loop-9g7b81) where router state updates got propagated _before_ other normal `useState` updates, which could lead to footguns in `useEffect` calls. ([#10377](https://github.com/remix-run/react-router/pull/10377), [#10409](https://github.com/remix-run/react-router/pull/10409))
|
| 170 | - Allow `useRevalidator()` to resolve a loader-driven error boundary scenario ([#10369](https://github.com/remix-run/react-router/pull/10369))
|
| 171 | - Avoid unnecessary unsubscribe/resubscribes on router state changes ([#10409](https://github.com/remix-run/react-router/pull/10409))
|
| 172 | - When using a `RouterProvider`, `useNavigate`/`useSubmit`/`fetcher.submit` are now stable across location changes, since we can handle relative routing via the `@remix-run/router` instance and get rid of our dependence on `useLocation()`. When using `BrowserRouter`, these hooks remain unstable across location changes because they still rely on `useLocation()`. ([#10336](https://github.com/remix-run/react-router/pull/10336))
|
| 173 | - Updated dependencies:
|
| 174 | - `@remix-run/router@1.6.0`
|
| 175 |
|
| 176 | ## 6.10.0
|
| 177 |
|
| 178 | ### Minor Changes
|
| 179 |
|
| 180 | - Added support for [**Future Flags**](https://reactrouter.com/en/main/guides/api-development-strategy) in React Router. The first flag being introduced is `future.v7_normalizeFormMethod` which will normalize the exposed `useNavigation()/useFetcher()` `formMethod` fields as uppercase HTTP methods to align with the `fetch()` behavior. ([#10207](https://github.com/remix-run/react-router/pull/10207))
|
| 181 |
|
| 182 | - When `future.v7_normalizeFormMethod === false` (default v6 behavior),
|
| 183 | - `useNavigation().formMethod` is lowercase
|
| 184 | - `useFetcher().formMethod` is lowercase
|
| 185 | - When `future.v7_normalizeFormMethod === true`:
|
| 186 | - `useNavigation().formMethod` is uppercase
|
| 187 | - `useFetcher().formMethod` is uppercase
|
| 188 |
|
| 189 | ### Patch Changes
|
| 190 |
|
| 191 | - Fix route ID generation when using Fragments in `createRoutesFromElements` ([#10193](https://github.com/remix-run/react-router/pull/10193))
|
| 192 | - Updated dependencies:
|
| 193 | - `@remix-run/router@1.5.0`
|
| 194 |
|
| 195 | ## 6.9.0
|
| 196 |
|
| 197 | ### Minor Changes
|
| 198 |
|
| 199 | - React Router now supports an alternative way to define your route `element` and `errorElement` fields as React Components instead of React Elements. You can instead pass a React Component to the new `Component` and `ErrorBoundary` fields if you choose. There is no functional difference between the two, so use whichever approach you prefer 😀. You shouldn't be defining both, but if you do `Component`/`ErrorBoundary` will "win". ([#10045](https://github.com/remix-run/react-router/pull/10045))
|
| 200 |
|
| 201 | **Example JSON Syntax**
|
| 202 |
|
| 203 | ```jsx
|
| 204 | // Both of these work the same:
|
| 205 | const elementRoutes = [{
|
| 206 | path: '/',
|
| 207 | element: <Home />,
|
| 208 | errorElement: <HomeError />,
|
| 209 | }]
|
| 210 |
|
| 211 | const componentRoutes = [{
|
| 212 | path: '/',
|
| 213 | Component: Home,
|
| 214 | ErrorBoundary: HomeError,
|
| 215 | }]
|
| 216 |
|
| 217 | function Home() { ... }
|
| 218 | function HomeError() { ... }
|
| 219 | ```
|
| 220 |
|
| 221 | **Example JSX Syntax**
|
| 222 |
|
| 223 | ```jsx
|
| 224 | // Both of these work the same:
|
| 225 | const elementRoutes = createRoutesFromElements(
|
| 226 | <Route path='/' element={<Home />} errorElement={<HomeError /> } />
|
| 227 | );
|
| 228 |
|
| 229 | const componentRoutes = createRoutesFromElements(
|
| 230 | <Route path='/' Component={Home} ErrorBoundary={HomeError} />
|
| 231 | );
|
| 232 |
|
| 233 | function Home() { ... }
|
| 234 | function HomeError() { ... }
|
| 235 | ```
|
| 236 |
|
| 237 | - **Introducing Lazy Route Modules!** ([#10045](https://github.com/remix-run/react-router/pull/10045))
|
| 238 |
|
| 239 | In order to keep your application bundles small and support code-splitting of your routes, we've introduced a new `lazy()` route property. This is an async function that resolves the non-route-matching portions of your route definition (`loader`, `action`, `element`/`Component`, `errorElement`/`ErrorBoundary`, `shouldRevalidate`, `handle`).
|
| 240 |
|
| 241 | Lazy routes are resolved on initial load and during the `loading` or `submitting` phase of a navigation or fetcher call. You cannot lazily define route-matching properties (`path`, `index`, `children`) since we only execute your lazy route functions after we've matched known routes.
|
| 242 |
|
| 243 | Your `lazy` functions will typically return the result of a dynamic import.
|
| 244 |
|
| 245 | ```jsx
|
| 246 | // In this example, we assume most folks land on the homepage so we include that
|
| 247 | // in our critical-path bundle, but then we lazily load modules for /a and /b so
|
| 248 | // they don't load until the user navigates to those routes
|
| 249 | let routes = createRoutesFromElements(
|
| 250 | <Route path="/" element={<Layout />}>
|
| 251 | <Route index element={<Home />} />
|
| 252 | <Route path="a" lazy={() => import("./a")} />
|
| 253 | <Route path="b" lazy={() => import("./b")} />
|
| 254 | </Route>
|
| 255 | );
|
| 256 | ```
|
| 257 |
|
| 258 | Then in your lazy route modules, export the properties you want defined for the route:
|
| 259 |
|
| 260 | ```jsx
|
| 261 | export async function loader({ request }) {
|
| 262 | let data = await fetchData(request);
|
| 263 | return json(data);
|
| 264 | }
|
| 265 |
|
| 266 | // Export a `Component` directly instead of needing to create a React Element from it
|
| 267 | export function Component() {
|
| 268 | let data = useLoaderData();
|
| 269 |
|
| 270 | return (
|
| 271 | <>
|
| 272 | <h1>You made it!</h1>
|
| 273 | <p>{data}</p>
|
| 274 | </>
|
| 275 | );
|
| 276 | }
|
| 277 |
|
| 278 | // Export an `ErrorBoundary` directly instead of needing to create a React Element from it
|
| 279 | export function ErrorBoundary() {
|
| 280 | let error = useRouteError();
|
| 281 | return isRouteErrorResponse(error) ? (
|
| 282 | <h1>
|
| 283 | {error.status} {error.statusText}
|
| 284 | </h1>
|
| 285 | ) : (
|
| 286 | <h1>{error.message || error}</h1>
|
| 287 | );
|
| 288 | }
|
| 289 | ```
|
| 290 |
|
| 291 | An example of this in action can be found in the [`examples/lazy-loading-router-provider`](https://github.com/remix-run/react-router/tree/main/examples/lazy-loading-router-provider) directory of the repository.
|
| 292 |
|
| 293 | 🙌 Huge thanks to @rossipedia for the [Initial Proposal](https://github.com/remix-run/react-router/discussions/9826) and [POC Implementation](https://github.com/remix-run/react-router/pull/9830).
|
| 294 |
|
| 295 | - Updated dependencies:
|
| 296 | - `@remix-run/router@1.4.0`
|
| 297 |
|
| 298 | ### Patch Changes
|
| 299 |
|
| 300 | - Fix `generatePath` incorrectly applying parameters in some cases ([#10078](https://github.com/remix-run/react-router/pull/10078))
|
| 301 | - Improve memoization for context providers to avoid unnecessary re-renders ([#9983](https://github.com/remix-run/react-router/pull/9983))
|
| 302 |
|
| 303 | ## 6.8.2
|
| 304 |
|
| 305 | ### Patch Changes
|
| 306 |
|
| 307 | - Updated dependencies:
|
| 308 | - `@remix-run/router@1.3.3`
|
| 309 |
|
| 310 | ## 6.8.1
|
| 311 |
|
| 312 | ### Patch Changes
|
| 313 |
|
| 314 | - Remove inaccurate console warning for POP navigations and update active blocker logic ([#10030](https://github.com/remix-run/react-router/pull/10030))
|
| 315 | - Updated dependencies:
|
| 316 | - `@remix-run/router@1.3.2`
|
| 317 |
|
| 318 | ## 6.8.0
|
| 319 |
|
| 320 | ### Patch Changes
|
| 321 |
|
| 322 | - Updated dependencies:
|
| 323 | - `@remix-run/router@1.3.1`
|
| 324 |
|
| 325 | ## 6.7.0
|
| 326 |
|
| 327 | ### Minor Changes
|
| 328 |
|
| 329 | - Add `unstable_useBlocker` hook for blocking navigations within the app's location origin ([#9709](https://github.com/remix-run/react-router/pull/9709))
|
| 330 |
|
| 331 | ### Patch Changes
|
| 332 |
|
| 333 | - Fix `generatePath` when optional params are present ([#9764](https://github.com/remix-run/react-router/pull/9764))
|
| 334 | - Update `<Await>` to accept `ReactNode` as children function return result ([#9896](https://github.com/remix-run/react-router/pull/9896))
|
| 335 | - Updated dependencies:
|
| 336 | - `@remix-run/router@1.3.0`
|
| 337 |
|
| 338 | ## 6.6.2
|
| 339 |
|
| 340 | ### Patch Changes
|
| 341 |
|
| 342 | - Ensure `useId` consistency during SSR ([#9805](https://github.com/remix-run/react-router/pull/9805))
|
| 343 |
|
| 344 | ## 6.6.1
|
| 345 |
|
| 346 | ### Patch Changes
|
| 347 |
|
| 348 | - Updated dependencies:
|
| 349 | - `@remix-run/router@1.2.1`
|
| 350 |
|
| 351 | ## 6.6.0
|
| 352 |
|
| 353 | ### Patch Changes
|
| 354 |
|
| 355 | - Prevent `useLoaderData` usage in `errorElement` ([#9735](https://github.com/remix-run/react-router/pull/9735))
|
| 356 | - Updated dependencies:
|
| 357 | - `@remix-run/router@1.2.0`
|
| 358 |
|
| 359 | ## 6.5.0
|
| 360 |
|
| 361 | This release introduces support for [Optional Route Segments](https://github.com/remix-run/react-router/issues/9546). Now, adding a `?` to the end of any path segment will make that entire segment optional. This works for both static segments and dynamic parameters.
|
| 362 |
|
| 363 | **Optional Params Examples**
|
| 364 |
|
| 365 | - `<Route path=":lang?/about>` will match:
|
| 366 | - `/:lang/about`
|
| 367 | - `/about`
|
| 368 | - `<Route path="/multistep/:widget1?/widget2?/widget3?">` will match:
|
| 369 | - `/multistep`
|
| 370 | - `/multistep/:widget1`
|
| 371 | - `/multistep/:widget1/:widget2`
|
| 372 | - `/multistep/:widget1/:widget2/:widget3`
|
| 373 |
|
| 374 | **Optional Static Segment Example**
|
| 375 |
|
| 376 | - `<Route path="/home?">` will match:
|
| 377 | - `/`
|
| 378 | - `/home`
|
| 379 | - `<Route path="/fr?/about">` will match:
|
| 380 | - `/about`
|
| 381 | - `/fr/about`
|
| 382 |
|
| 383 | ### Minor Changes
|
| 384 |
|
| 385 | - Allows optional routes and optional static segments ([#9650](https://github.com/remix-run/react-router/pull/9650))
|
| 386 |
|
| 387 | ### Patch Changes
|
| 388 |
|
| 389 | - Stop incorrectly matching on partial named parameters, i.e. `<Route path="prefix-:param">`, to align with how splat parameters work. If you were previously relying on this behavior then it's recommended to extract the static portion of the path at the `useParams` call site: ([#9506](https://github.com/remix-run/react-router/pull/9506))
|
| 390 |
|
| 391 | ```jsx
|
| 392 | // Old behavior at URL /prefix-123
|
| 393 | <Route path="prefix-:id" element={<Comp /> }>
|
| 394 |
|
| 395 | function Comp() {
|
| 396 | let params = useParams(); // { id: '123' }
|
| 397 | let id = params.id; // "123"
|
| 398 | ...
|
| 399 | }
|
| 400 |
|
| 401 | // New behavior at URL /prefix-123
|
| 402 | <Route path=":id" element={<Comp /> }>
|
| 403 |
|
| 404 | function Comp() {
|
| 405 | let params = useParams(); // { id: 'prefix-123' }
|
| 406 | let id = params.id.replace(/^prefix-/, ''); // "123"
|
| 407 | ...
|
| 408 | }
|
| 409 | ```
|
| 410 |
|
| 411 | - Updated dependencies:
|
| 412 | - `@remix-run/router@1.1.0`
|
| 413 |
|
| 414 | ## 6.4.5
|
| 415 |
|
| 416 | ### Patch Changes
|
| 417 |
|
| 418 | - Updated dependencies:
|
| 419 | - `@remix-run/router@1.0.5`
|
| 420 |
|
| 421 | ## 6.4.4
|
| 422 |
|
| 423 | ### Patch Changes
|
| 424 |
|
| 425 | - Updated dependencies:
|
| 426 | - `@remix-run/router@1.0.4`
|
| 427 |
|
| 428 | ## 6.4.3
|
| 429 |
|
| 430 | ### Patch Changes
|
| 431 |
|
| 432 | - `useRoutes` should be able to return `null` when passing `locationArg` ([#9485](https://github.com/remix-run/react-router/pull/9485))
|
| 433 | - fix `initialEntries` type in `createMemoryRouter` ([#9498](https://github.com/remix-run/react-router/pull/9498))
|
| 434 | - Updated dependencies:
|
| 435 | - `@remix-run/router@1.0.3`
|
| 436 |
|
| 437 | ## 6.4.2
|
| 438 |
|
| 439 | ### Patch Changes
|
| 440 |
|
| 441 | - Fix `IndexRouteObject` and `NonIndexRouteObject` types to make `hasErrorElement` optional ([#9394](https://github.com/remix-run/react-router/pull/9394))
|
| 442 | - Enhance console error messages for invalid usage of data router hooks ([#9311](https://github.com/remix-run/react-router/pull/9311))
|
| 443 | - If an index route has children, it will result in a runtime error. We have strengthened our `RouteObject`/`RouteProps` types to surface the error in TypeScript. ([#9366](https://github.com/remix-run/react-router/pull/9366))
|
| 444 | - Updated dependencies:
|
| 445 | - `@remix-run/router@1.0.2`
|
| 446 |
|
| 447 | ## 6.4.1
|
| 448 |
|
| 449 | ### Patch Changes
|
| 450 |
|
| 451 | - Preserve state from `initialEntries` ([#9288](https://github.com/remix-run/react-router/pull/9288))
|
| 452 | - Updated dependencies:
|
| 453 | - `@remix-run/router@1.0.1`
|
| 454 |
|
| 455 | ## 6.4.0
|
| 456 |
|
| 457 | Whoa this is a big one! `6.4.0` brings all the data loading and mutation APIs over from Remix. Here's a quick high level overview, but it's recommended you go check out the [docs][rr-docs], especially the [feature overview][rr-feature-overview] and the [tutorial][rr-tutorial].
|
| 458 |
|
| 459 | **New APIs**
|
| 460 |
|
| 461 | - Create your router with `createMemoryRouter`
|
| 462 | - Render your router with `<RouterProvider>`
|
| 463 | - Load data with a Route `loader` and mutate with a Route `action`
|
| 464 | - Handle errors with Route `errorElement`
|
| 465 | - Defer non-critical data with `defer` and `Await`
|
| 466 |
|
| 467 | **Bug Fixes**
|
| 468 |
|
| 469 | - Path resolution is now trailing slash agnostic (#8861)
|
| 470 | - `useLocation` returns the scoped location inside a `<Routes location>` component (#9094)
|
| 471 |
|
| 472 | **Updated Dependencies**
|
| 473 |
|
| 474 | - `@remix-run/router@1.0.0`
|
| 475 |
|
| 476 | [rr-docs]: https://reactrouter.com
|
| 477 | [rr-feature-overview]: https://reactrouter.com/start/overview
|
| 478 | [rr-tutorial]: https://reactrouter.com/start/tutorial
|