Skip to content

Commit

Permalink
docs: Add useMatch section in upgrade docs (#8280)
Browse files Browse the repository at this point in the history
  • Loading branch information
chaance committed Nov 8, 2021
1 parent bda3295 commit 23fccd1
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions docs/upgrading/v5.md
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,20 @@ import { StaticRouter } from "react-router-dom/server";

This change was made both to follow more closely the convention established by the `react-dom` package and to help users understand better what a `<StaticRouter>` is for and when it should be used (on the server).

## Replace `useRouteMatch` with `useMatch`

`useMatch` is very similar to v5's `useRouteMatch`, with a few key differences:

- It uses our new [path pattern matching algorithm](#note-on-route-path-patterns)
- The pattern argument is now required
- No longer accepts an array of patterns
- When passing a pattern as an object, some of the options have been renamed to better align with other APIs in v6
- `useRouteMatch({ strict })` is now `useMatch({ end })`
- `useRouteMatch({ sensitive })` is now `useMatch({ caseSensitive })`
- It returns a match object with a different shape

To see the exact API of the new `useMatch` hook and its type declaration, check out our [API Reference](../api.md#usematch). <!-- TODO: Show examples for refactoring useRouteMatch -->

## What did we miss?

Despite our best attempts at being thorough, it's very likely that we missed something. If you follow this upgrade guide and find that to be the case, please let us know. We are happy to help you figure out what to do with your v5 code to be able to upgrade and take advantage of all of the cool stuff in v6.
Expand Down

0 comments on commit 23fccd1

Please sign in to comment.