react-router 6.4.5 → 6.5.0-pre.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +47 -0
- package/dist/index.js +1 -1
- package/dist/main.js +1 -1
- package/dist/react-router.development.js +1 -1
- package/dist/react-router.production.min.js +1 -1
- package/dist/umd/react-router.development.js +1 -1
- package/dist/umd/react-router.production.min.js +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,52 @@
|
|
|
1
1
|
# `react-router`
|
|
2
2
|
|
|
3
|
+
## 6.5.0-pre.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Support for optional path segments ([#9650](https://github.com/remix-run/react-router/pull/9650))
|
|
8
|
+
- You can now denote optional path segments with a `?` as the last character in a path segment
|
|
9
|
+
- Optional params examples
|
|
10
|
+
- `:lang?/about` will get expanded and match:
|
|
11
|
+
- `/:lang/about`
|
|
12
|
+
- `/about`
|
|
13
|
+
- `/multistep/:widget1?/widget2?/widget3?` will get expanded and match:
|
|
14
|
+
- `/multistep/:widget1/:widget2/:widget3`
|
|
15
|
+
- `/multistep/:widget1/:widget2`
|
|
16
|
+
- `/multistep/:widget1`
|
|
17
|
+
- `/multistep`
|
|
18
|
+
- Optional static segment example
|
|
19
|
+
- `/fr?/about` will get expanded and match:
|
|
20
|
+
- `/fr/about`
|
|
21
|
+
- `/about`
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- 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))
|
|
26
|
+
|
|
27
|
+
```jsx
|
|
28
|
+
// Old behavior at URL /prefix-123
|
|
29
|
+
<Route path="prefix-:id" element={<Comp /> }>
|
|
30
|
+
|
|
31
|
+
function Comp() {
|
|
32
|
+
let params = useParams(); // { id: '123' }
|
|
33
|
+
let id = params.id; // "123"
|
|
34
|
+
...
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// New behavior at URL /prefix-123
|
|
38
|
+
<Route path=":id" element={<Comp /> }>
|
|
39
|
+
|
|
40
|
+
function Comp() {
|
|
41
|
+
let params = useParams(); // { id: 'prefix-123' }
|
|
42
|
+
let id = params.id.replace(/^prefix-/, ''); // "123"
|
|
43
|
+
...
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
- Updated dependencies:
|
|
48
|
+
- `@remix-run/router@1.1.0-pre.0`
|
|
49
|
+
|
|
3
50
|
## 6.4.5
|
|
4
51
|
|
|
5
52
|
### Patch Changes
|
package/dist/index.js
CHANGED
package/dist/main.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-router",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.5.0-pre.0",
|
|
4
4
|
"description": "Declarative routing for React",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"module": "./dist/index.js",
|
|
24
24
|
"types": "./dist/index.d.ts",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@remix-run/router": "1.0.
|
|
26
|
+
"@remix-run/router": "1.1.0-pre.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"react": "^18.2.0"
|