Skip to content

Commit 381e905

Browse files
committed
chore: format
1 parent 36f7202 commit 381e905

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

docs/upgrading/v5.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -893,39 +893,42 @@ To see the exact API of the new `useMatch` hook and its type declaration, check
893893

894894
## Change the order of arguments passed to `matchPath`. Change pathPattern options.
895895

896-
Since version 6 the order of arguments passed to `matchPath` function has changed. Also pattern options has changed.
896+
Since version 6 the order of arguments passed to `matchPath` function has changed. Also pattern options has changed.
897897

898898
- first argument is pathPattern object, then comes pathname
899899
- pathPattern doesn't include `exact` and `strict` options any more. New `caseSensitive` and `end` options has been added.
900900

901901
Please refactor it as follows:
902902

903903
Before:
904+
904905
```js
905906
// This is a React Router v5 app
906907
import { matchPath } from "react-router-dom";
907908

908909
const match = matchPath("/users/123", {
909910
path: "/users/:id",
910-
exact: true, // Optional, defaults to false
911-
strict: false // Optional, defaults to false
911+
exact: true, // Optional, defaults to false
912+
strict: false, // Optional, defaults to false
912913
});
913914
```
914915

915916
After:
917+
916918
```js
917919
// This is a React Router v6 app
918920
import { matchPath } from "react-router-dom";
919921

920-
const match = matchPath({
921-
path: "/users/:id",
922-
caseSensitive: false, // Optional. Should be `true` if the static portions of the `path` should be matched in the same case.
923-
end: true // Optional. Should be `true` if this pattern should match the entire URL pathname
924-
}, "/users/123");
922+
const match = matchPath(
923+
{
924+
path: "/users/:id",
925+
caseSensitive: false, // Optional. Should be `true` if the static portions of the `path` should be matched in the same case.
926+
end: true, // Optional. Should be `true` if this pattern should match the entire URL pathname
927+
},
928+
"/users/123"
929+
);
925930
```
926931

927-
928-
929932
## `<Prompt>` is not currently supported
930933

931934
`<Prompt>` from v5 (along with `usePrompt` and `useBlocker` from the v6 betas) are not included in the current released version of v6. We decided we'd rather ship with what we have than take even more time to nail down a feature that isn't fully baked. We will absolutely be working on adding this back in to v6 at some point in the near future, but not for our first stable release of 6.x.

0 commit comments

Comments
 (0)