UNPKG

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