1 | # `react-router`
|
2 |
|
3 | ## 6.7.0
|
4 |
|
5 | ### Minor Changes
|
6 |
|
7 | - Add `unstable_useBlocker` hook for blocking navigations within the app's location origin ([#9709](https://github.com/remix-run/react-router/pull/9709))
|
8 |
|
9 | ### Patch Changes
|
10 |
|
11 | - Fix `generatePath` when optional params are present ([#9764](https://github.com/remix-run/react-router/pull/9764))
|
12 | - Update `<Await>` to accept `ReactNode` as children function return result ([#9896](https://github.com/remix-run/react-router/pull/9896))
|
13 | - Updated dependencies:
|
14 | - `@remix-run/router@1.3.0`
|
15 |
|
16 | ## 6.6.2
|
17 |
|
18 | ### Patch Changes
|
19 |
|
20 | - Ensure `useId` consistency during SSR ([#9805](https://github.com/remix-run/react-router/pull/9805))
|
21 |
|
22 | ## 6.6.2-pre.0
|
23 |
|
24 | ### Patch Changes
|
25 |
|
26 | - Ensure `useId` consistency during SSR ([#9805](https://github.com/remix-run/react-router/pull/9805))
|
27 |
|
28 | ## 6.6.1
|
29 |
|
30 | ### Patch Changes
|
31 |
|
32 | - Updated dependencies:
|
33 | - `@remix-run/router@1.2.1`
|
34 |
|
35 | ## 6.6.0
|
36 |
|
37 | ### Patch Changes
|
38 |
|
39 | - Prevent `useLoaderData` usage in `errorElement` ([#9735](https://github.com/remix-run/react-router/pull/9735))
|
40 | - Updated dependencies:
|
41 | - `@remix-run/router@1.2.0`
|
42 |
|
43 | ## 6.5.0
|
44 |
|
45 | 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.
|
46 |
|
47 | **Optional Params Examples**
|
48 |
|
49 | - `<Route path=":lang?/about>` will match:
|
50 | - `/:lang/about`
|
51 | - `/about`
|
52 | - `<Route path="/multistep/:widget1?/widget2?/widget3?">` will match:
|
53 | - `/multistep`
|
54 | - `/multistep/:widget1`
|
55 | - `/multistep/:widget1/:widget2`
|
56 | - `/multistep/:widget1/:widget2/:widget3`
|
57 |
|
58 | **Optional Static Segment Example**
|
59 |
|
60 | - `<Route path="/home?">` will match:
|
61 | - `/`
|
62 | - `/home`
|
63 | - `<Route path="/fr?/about">` will match:
|
64 | - `/about`
|
65 | - `/fr/about`
|
66 |
|
67 | ### Minor Changes
|
68 |
|
69 | - Allows optional routes and optional static segments ([#9650](https://github.com/remix-run/react-router/pull/9650))
|
70 |
|
71 | ### Patch Changes
|
72 |
|
73 | - 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))
|
74 |
|
75 | ```jsx
|
76 | // Old behavior at URL /prefix-123
|
77 | }>
|
78 |
|
79 | function Comp() {
|
80 | let params = useParams(); // { id: '123' }
|
81 | let id = params.id; // "123"
|
82 | ...
|
83 | }
|
84 |
|
85 | // New behavior at URL /prefix-123
|
86 | }>
|
87 |
|
88 | function Comp() {
|
89 | let params = useParams(); // { id: 'prefix-123' }
|
90 | let id = params.id.replace(/^prefix-/, ''); // "123"
|
91 | ...
|
92 | }
|
93 | ```
|
94 |
|
95 | - Updated dependencies:
|
96 | - `@remix-run/router@1.1.0`
|
97 |
|
98 | ## 6.4.5
|
99 |
|
100 | ### Patch Changes
|
101 |
|
102 | - Updated dependencies:
|
103 | - `@remix-run/router@1.0.5`
|
104 |
|
105 | ## 6.4.4
|
106 |
|
107 | ### Patch Changes
|
108 |
|
109 | - Updated dependencies:
|
110 | - `@remix-run/router@1.0.4`
|
111 |
|
112 | ## 6.4.3
|
113 |
|
114 | ### Patch Changes
|
115 |
|
116 | - `useRoutes` should be able to return `null` when passing `locationArg` ([#9485](https://github.com/remix-run/react-router/pull/9485))
|
117 | - fix `initialEntries` type in `createMemoryRouter` ([#9498](https://github.com/remix-run/react-router/pull/9498))
|
118 | - Updated dependencies:
|
119 | - `@remix-run/router@1.0.3`
|
120 |
|
121 | ## 6.4.2
|
122 |
|
123 | ### Patch Changes
|
124 |
|
125 | - Fix `IndexRouteObject` and `NonIndexRouteObject` types to make `hasErrorElement` optional ([#9394](https://github.com/remix-run/react-router/pull/9394))
|
126 | - Enhance console error messages for invalid usage of data router hooks ([#9311](https://github.com/remix-run/react-router/pull/9311))
|
127 | - 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))
|
128 | - Updated dependencies:
|
129 | - `@remix-run/router@1.0.2`
|
130 |
|
131 | ## 6.4.1
|
132 |
|
133 | ### Patch Changes
|
134 |
|
135 | - Preserve state from `initialEntries` ([#9288](https://github.com/remix-run/react-router/pull/9288))
|
136 | - Updated dependencies:
|
137 | - `@remix-run/router@1.0.1`
|
138 |
|
139 | ## 6.4.0
|
140 |
|
141 | 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].
|
142 |
|
143 | **New APIs**
|
144 |
|
145 | - Create your router with `createMemoryRouter`
|
146 | - Render your router with `<RouterProvider>`
|
147 | - Load data with a Route `loader` and mutate with a Route `action`
|
148 | - Handle errors with Route `errorElement`
|
149 | - Defer non-critical data with `defer` and `Await`
|
150 |
|
151 | **Bug Fixes**
|
152 |
|
153 | - Path resolution is now trailing slash agnostic (#8861)
|
154 | - `useLocation` returns the scoped location inside a `<Routes location>` component (#9094)
|
155 |
|
156 | **Updated Dependencies**
|
157 |
|
158 | - `@remix-run/router@1.0.0`
|
159 |
|
160 | [rr-docs]: https://reactrouter.com
|
161 | [rr-feature-overview]: https://reactrouter.com/start/overview
|
162 | [rr-tutorial]: https://reactrouter.com/start/tutorial
|