diff --git a/contributors.yml b/contributors.yml index f2f03d0497..e26873a99f 100644 --- a/contributors.yml +++ b/contributors.yml @@ -6,6 +6,7 @@ - chaance - chasinhues - christopherchudzicki +- cvbuelow - edwin177 - elylucas - hongji00 diff --git a/docs/upgrading/v5.md b/docs/upgrading/v5.md index fca0c8cfc2..6c66ffe615 100644 --- a/docs/upgrading/v5.md +++ b/docs/upgrading/v5.md @@ -638,7 +638,17 @@ function App() { } ``` -If you need to replace the current location instead of push a new one onto the history stack, use `navigate(to, { replace: true })`. If you need state, use `navigate(to, { state })`. You can think of the first argument to `navigate` as your `` and the other arguments as the `replace` and `state` props. +If you need to replace the current location instead of push a new one onto the history stack, use `navigate(to, { replace: true })`. If you need state, use `navigate(to, { state })`. You can think of the first argument to `navigate` as your `` and the other arguments as the `replace` and `state` props. The `Link` component in v6 accepts `state` as a separate prop instead of receiving it as part of the object passed to `to` so you'll need to update your `Link` components if they are using `state`: + +```js +import { Link } from "react-router-dom"; + +// Change this: + + +// to this: + +``` If you prefer to use a declarative API for navigation (ala v5's `Redirect` component), v6 provides a `Navigate` component. Use it like: