You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[Prerendering with a SPA Fallback](#prerendering-with-a-spa-fallback)
19
20
-[Allow a root `loader` in SPA Mode](#allow-a-root-loader-in-spa-mode)
20
21
-[Minor Changes](#minor-changes)
@@ -287,6 +288,36 @@ Date: 2025-02-13
287
288
288
289
### What's Changed
289
290
291
+
#### Type-safe `href` utility
292
+
293
+
In framework mode, we now provide you with a fully type-safe `href` utility to give you all the warm and fuzzy feelings of path auto-completion and param validation for links in your application:
294
+
295
+
```tsx
296
+
import { href } from"react-router";
297
+
298
+
exportdefaultfunction Component() {
299
+
const link =href("/blog/:slug", { slug: "my-first-post" });
This release enhances the ability to use a combination of pre-rendered paths alongside other paths that operate in "SPA Mode" when pre-rendering with `ssr:false`.
@@ -309,6 +340,7 @@ In order to use your build-time loader data during pre-rendering, we now also ex
309
340
310
341
### Minor Changes
311
342
343
+
-`react-router` - New type-safe `href` utility that guarantees links point to actual paths in your app ([#13012](https://github.com/remix-run/react-router/pull/13012))
312
344
-`@react-router/dev` - Generate a "SPA fallback" HTML file when pre-rendering the `/` route with `ssr:false` ([#12948](https://github.com/remix-run/react-router/pull/12948))
313
345
-`@react-router/dev` - Allow a `loader` in the root route in SPA mode because it can be called/server-rendered at build time ([#12948](https://github.com/remix-run/react-router/pull/12948))
314
346
-`Route.HydrateFallbackProps` now also receives `loaderData`
@@ -334,6 +366,14 @@ In order to use your build-time loader data during pre-rendering, we now also ex
334
366
- When using `ssr:false` without a `prerender` config, only the `root` route can have a `loader`
335
367
- When using `ssr:false` with a `prerender` config, only routes matched by a `prerender` path can have a `loader`
336
368
-`@react-router/dev` - Limit prerendered resource route `.data` files to only the target route ([#13004](https://github.com/remix-run/react-router/pull/13004))
369
+
-`@react-router/dev` - Fix typegen for repeated params ([#13012](https://github.com/remix-run/react-router/pull/13012))
370
+
- In React Router, path parameters are keyed by their name, so for a path pattern like `/a/:id/b/:id?/c/:id`, the last `:id` will set the value for `id` in `useParams` and the `params` prop
371
+
- For example, `/a/1/b/2/c/3` will result in the value `{ id: 3 }` at runtime
372
+
- Previously, generated types for params incorrectly modeled repeated params with an array
373
+
- For example, `/a/1/b/2/c/3` generated a type like `{ id: [1,2,3] }`.
374
+
- To be consistent with runtime behavior, the generated types now correctly model the "last one wins" semantics of path parameters.
375
+
- For example, `/a/1/b/2/c/3` now generates a type like `{ id: 3 }`.
376
+
-`@react-router/dev` - Fix path to load `package.json` for `react-router --version` ([#13012](https://github.com/remix-run/react-router/pull/13012))
0 commit comments