We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Learn more about funding links in repositories.
Report abuse
1 parent 3ccbd19 commit 29155fcCopy full SHA for 29155fc
packages/react-router/docs/api/matchPath.md
@@ -29,3 +29,34 @@ to the matching props `Route` accepts:
29
exact; // optional, defaults to false
30
}
31
```
32
+
33
+## returns
34
35
+It returns an object when provided pathname does match `path` prop or `null` otherwise.
36
37
+```
38
+matchPath("/users/2", {
39
+ path: "/users/:id",
40
+ exact: true,
41
+ strict: true
42
+ })
43
44
+// {
45
+// isExact: true
46
+// params: {
47
+// id: "2"
48
+// }
49
+// path: "/users/:id"
50
+// url: "/users/2"
51
52
53
54
55
+matchPath("/users", {
56
57
58
59
60
61
+// null
62
0 commit comments