Skip to content

Commit

Permalink
Update matchPath docs (#6703)
Browse files Browse the repository at this point in the history
* Update matchPath.md

* Update matchPath.md

* Update matchPath.md
  • Loading branch information
h-des authored and timdorr committed Apr 14, 2019
1 parent 3ccbd19 commit 29155fc
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions packages/react-router/docs/api/matchPath.md
Expand Up @@ -29,3 +29,34 @@ to the matching props `Route` accepts:
exact; // optional, defaults to false
}
```

## returns

It returns an object when provided pathname does match `path` prop or `null` otherwise.

```
matchPath("/users/2", {
path: "/users/:id",
exact: true,
strict: true
})
// {
// isExact: true
// params: {
// id: "2"
// }
// path: "/users/:id"
// url: "/users/2"
// }
```

```
matchPath("/users", {
path: "/users/:id",
exact: true,
strict: true
})
// null
```

0 comments on commit 29155fc

Please sign in to comment.