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
Copy file name to clipboardExpand all lines: CHANGELOG.md
+10-16Lines changed: 10 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -348,7 +348,6 @@ Date: 2025-06-27
348
348
### Patch Changes
349
349
350
350
- `react-router` - Do not serialize types for `useRouteLoaderData<typeof clientLoader>` ([#13752](https://github.com/remix-run/react-router/pull/13752))
351
-
352
351
- For types to distinguish a `clientLoader` from a `serverLoader`, you MUST annotate `clientLoader` args:
353
352
354
353
```ts
@@ -449,7 +448,6 @@ Date: 2025-05-25
449
448
- `@react-router/dev` - Add additional logging to `build` command output when cleaning assets from server build ([#13547](https://github.com/remix-run/react-router/pull/13547))
450
449
- `@react-router/dev` - Don't clean assets from server build when `build.ssrEmitAssets` has been enabled in Vite config ([#13547](https://github.com/remix-run/react-router/pull/13547))
451
450
- `@react-router/dev` - Fix typegen when same route is used at multiple paths ([#13574](https://github.com/remix-run/react-router/pull/13574))
452
-
453
451
- For example, `routes/route.tsx` is used at 4 different paths here:
454
452
455
453
```ts
@@ -468,7 +466,6 @@ Date: 2025-05-25
468
466
- Now, typegen creates unions as necessary for alternate paths for the same route file
469
467
470
468
- `@react-router/dev` - Better types for `params` ([#13543](https://github.com/remix-run/react-router/pull/13543))
471
-
472
469
- For example:
473
470
474
471
```ts
@@ -515,7 +512,6 @@ Date: 2025-05-25
515
512
```
516
513
517
514
- `@react-router/dev` - Fix `href` for optional segments ([#13595](https://github.com/remix-run/react-router/pull/13595))
518
-
519
515
- Type generation now expands paths with optionals into their corresponding non-optional paths
520
516
- For example, the path `/user/:id?` gets expanded into `/user` and `/user/:id` to more closely model visitable URLs
521
517
- `href` then uses these expanded (non-optional) paths to construct type-safe paths for your app:
@@ -623,7 +619,6 @@ Behind the scenes, React Router will generate the corresponding `declare module`
623
619
624
620
- `react-router` - Added a new `routeDiscovery` option in `react-router.config.ts` to configure Lazy Route Discovery behavior ([#13451](https://github.com/remix-run/react-router/pull/13451))
625
621
- `react-router` - Add support for route component props in `createRoutesStub` ([#13528](https://github.com/remix-run/react-router/pull/13528))
626
-
627
622
- This allows you to unit test your route components using the props instead of the hooks:
628
623
629
624
```tsx
@@ -742,7 +737,6 @@ Date: 2025-04-17
742
737
### Patch Changes
743
738
744
739
- `react-router` - When using the object-based `route.lazy` API, the `HydrateFallback` and `hydrateFallbackElement` properties are now skipped when lazy loading routes after hydration ([#13376](https://github.com/remix-run/react-router/pull/13376))
745
-
746
740
- If you move the code for these properties into a separate file, since the hydrate properties were unused already (if the route wasn't present during hydration), you can avoid downloading them at all. For example:
747
741
748
742
```ts
@@ -1047,7 +1041,7 @@ Here's a simple example of a client-side logging middleware that can be placed o
Copy file name to clipboardExpand all lines: GOVERNANCE.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,7 @@
18
18
React Router has been around since 2014 largely under the development and oversight of [Michael Jackson](https://x.com/mjackson) and [Ryan Florence](https://x.com/ryanflorence). After the launch of [Remix](https://remix.run/) in 2021, the subsequent creation of the Remix team, and the merging of Remix v2 into React Router v7[^1][^2], the project shifted from a [Founder-Leader](https://www.redhat.com/en/blog/understanding-open-source-governance-models) model to a "Steering Committee" (SC) model that operates on a Request for Comments (RFC) process.
This document will outline the process in which React Router will continue to evolve and how new features will make their way into the codebase. This is an evergreen document and will be updated as needed to reflect future changes in the process.
Copy file name to clipboardExpand all lines: decisions/0010-splitting-up-client-and-server-code-in-vite.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -96,6 +96,7 @@ Checking for `.server` modules only requires checking the module's path and does
96
96
`vite-env-only` does require AST parsing and transformations so it will always be slower than `.server` modules.
97
97
98
98
[^1]: Vite provides a lower-level module graph API, but the module graph is not guaranteed to be complete as it is only populated as modules are requested.
99
+
99
100
[^2]: When a file changes on disk, Vite invalidates the corresponding module in its cache to power features like HMR.
Copy file name to clipboardExpand all lines: docs/explanation/state-management.md
+2-4Lines changed: 2 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,14 +25,12 @@ React Router seamlessly bridges the gap between the backend and frontend via mec
25
25
Here's why using typical React state patterns might be an anti-pattern in React Router:
26
26
27
27
1.**Network-related State:** If your React state is managing anything related to the network—such as data from loaders, pending form submissions, or navigational states—it's likely that you're managing state that React Router already manages:
28
-
29
28
-**[`useNavigation`][use_navigation]**: This hook gives you access to `navigation.state`, `navigation.formData`, `navigation.location`, etc.
30
29
-**[`useFetcher`][use_fetcher]**: This facilitates interaction with `fetcher.state`, `fetcher.formData`, `fetcher.data` etc.
31
30
-**[`loaderData`][loader_data]**: Access the data for a route.
32
31
-**[`actionData`][action_data]**: Access the data from the latest action.
33
32
34
33
2.**Storing Data in React Router:** A lot of data that developers might be tempted to store in React state has a more natural home in React Router, such as:
35
-
36
34
-**URL Search Params:** Parameters within the URL that hold state.
37
35
-**[Cookies][cookies]:** Small pieces of data stored on the user's device.
38
36
-**[Server Sessions][sessions]:** Server-managed user sessions.
@@ -80,7 +78,7 @@ export function List() {
80
78
const navigate =useNavigate();
81
79
const [searchParams] =useSearchParams();
82
80
const [view, setView] =useState(
83
-
searchParams.get("view") ||"list"
81
+
searchParams.get("view") ||"list",
84
82
);
85
83
86
84
return (
@@ -226,7 +224,7 @@ In this approach, state must be initialized within an effect. This is crucial to
0 commit comments