From a38c8efa8df1466532f094d3d2098b1786689533 Mon Sep 17 00:00:00 2001 From: Carl von Buelow Date: Mon, 14 Feb 2022 17:59:06 -0500 Subject: [PATCH 1/2] Update v5 migration guide for Link changes --- docs/upgrading/v5.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/upgrading/v5.md b/docs/upgrading/v5.md index fca0c8cfc..6c66ffe61 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: From f6c293d933a2124d83f3fc89bfc998e539414499 Mon Sep 17 00:00:00 2001 From: Carl von Buelow Date: Mon, 14 Feb 2022 18:01:37 -0500 Subject: [PATCH 2/2] Add name to contributors --- contributors.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/contributors.yml b/contributors.yml index f2f03d049..e26873a99 100644 --- a/contributors.yml +++ b/contributors.yml @@ -6,6 +6,7 @@ - chaance - chasinhues - christopherchudzicki +- cvbuelow - edwin177 - elylucas - hongji00