Skip to content

Commit 15808fa

Browse files
committed
Upgrade to React Router v6
1 parent 65f27aa commit 15808fa

File tree

3 files changed

+30
-86
lines changed

3 files changed

+30
-86
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"react-ga": "^3.3.1",
1111
"react-phone-number-input": "^3.2.11",
1212
"react-redux": "^8.0.4",
13-
"react-router-dom": "^5.0.1",
13+
"react-router-dom": "^6.4.2",
1414
"react-scripts": "5.0.1",
1515
"reactstrap": "^8.0.1",
1616
"redux": "^4.0.4",

src/Routes/index.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react'
2-
import { Route, Switch, useLocation, useParams } from 'react-router-dom'
2+
import { Route, Routes, useLocation, useParams } from 'react-router-dom'
33

44
import Forms from '../Components/forms'
55
import NotFound from '../Components/NotFound'
@@ -11,15 +11,11 @@ function WithRouteProps({ children: Component }) {
1111
}
1212

1313
export default () => (
14-
<Switch>
15-
<Route exact path="/">
16-
<WithRouteProps children={Forms} />
14+
<Routes>
15+
<Route path="/" element={<WithRouteProps children={Forms} />} />
16+
<Route path="/code/:userId" element={<WithRouteProps children={Forms} />}>
17+
<Route path=":code" element={<WithRouteProps children={Forms} />} />
1718
</Route>
18-
<Route exact path="/code/:userId/:code?">
19-
<WithRouteProps children={Forms} />
20-
</Route>
21-
<Route path="*">
22-
<NotFound />
23-
</Route>
24-
</Switch>
19+
<Route path="*" element={<NotFound />} />
20+
</Routes>
2521
)

yarn.lock

Lines changed: 22 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,7 @@
10311031
core-js-pure "^3.25.1"
10321032
regenerator-runtime "^0.13.4"
10331033

1034-
"@babel/runtime@^7.1.2", "@babel/runtime@^7.10.2", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.1", "@babel/runtime@^7.12.13", "@babel/runtime@^7.12.5", "@babel/runtime@^7.14.6", "@babel/runtime@^7.16.3", "@babel/runtime@^7.18.9", "@babel/runtime@^7.8.4", "@babel/runtime@^7.9.2":
1034+
"@babel/runtime@^7.1.2", "@babel/runtime@^7.10.2", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.1", "@babel/runtime@^7.12.5", "@babel/runtime@^7.14.6", "@babel/runtime@^7.16.3", "@babel/runtime@^7.18.9", "@babel/runtime@^7.8.4", "@babel/runtime@^7.9.2":
10351035
version "7.19.0"
10361036
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.19.0.tgz#22b11c037b094d27a8a2504ea4dcff00f50e2259"
10371037
integrity sha512-eR8Lo9hnDS7tqkO7NsV+mKvCmv5boaXFSZ70DnfhcgiEne8hv9oCEd36Klw74EtizEqLsy4YnW8UWwpBVolHZA==
@@ -1601,6 +1601,11 @@
16011601
schema-utils "^3.0.0"
16021602
source-map "^0.7.3"
16031603

1604+
"@remix-run/[email protected]":
1605+
version "1.0.2"
1606+
resolved "https://registry.yarnpkg.com/@remix-run/router/-/router-1.0.2.tgz#1c17eadb2fa77f80a796ad5ea9bf108e6993ef06"
1607+
integrity sha512-GRSOFhJzjGN+d4sKHTMSvNeUPoZiDHWmRnXfzaxrqe7dE/Nzlc8BiMSJdLDESZlndM7jIUrZ/F4yWqVYlI0rwQ==
1608+
16041609
"@rollup/plugin-babel@^5.2.0":
16051610
version "5.3.1"
16061611
resolved "https://registry.yarnpkg.com/@rollup/plugin-babel/-/plugin-babel-5.3.1.tgz#04bc0608f4aa4b2e4b1aebf284344d0f68fda283"
@@ -5247,19 +5252,7 @@ he@^1.2.0:
52475252
resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f"
52485253
integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==
52495254

5250-
history@^4.9.0:
5251-
version "4.10.1"
5252-
resolved "https://registry.yarnpkg.com/history/-/history-4.10.1.tgz#33371a65e3a83b267434e2b3f3b1b4c58aad4cf3"
5253-
integrity sha512-36nwAD620w12kuzPAsyINPWJqlNbij+hpK1k9XRloDtym8mxzGYl2c17LnV6IAGB2Dmg4tEa7G7DlawS0+qjew==
5254-
dependencies:
5255-
"@babel/runtime" "^7.1.2"
5256-
loose-envify "^1.2.0"
5257-
resolve-pathname "^3.0.0"
5258-
tiny-invariant "^1.0.2"
5259-
tiny-warning "^1.0.0"
5260-
value-equal "^1.0.1"
5261-
5262-
hoist-non-react-statics@^3.1.0, hoist-non-react-statics@^3.3.0, hoist-non-react-statics@^3.3.2:
5255+
hoist-non-react-statics@^3.3.0, hoist-non-react-statics@^3.3.2:
52635256
version "3.3.2"
52645257
resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz#ece0acaf71d62c2969c2ec59feff42a4b1a85b45"
52655258
integrity sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==
@@ -5776,11 +5769,6 @@ is-wsl@^2.2.0:
57765769
dependencies:
57775770
is-docker "^2.0.0"
57785771

5779-
5780-
version "0.0.1"
5781-
resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf"
5782-
integrity sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==
5783-
57845772
isarray@~1.0.0:
57855773
version "1.0.0"
57865774
resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11"
@@ -6702,7 +6690,7 @@ log-update@^4.0.0:
67026690
slice-ansi "^4.0.0"
67036691
wrap-ansi "^6.2.0"
67046692

6705-
loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.2.0, loose-envify@^1.3.1, loose-envify@^1.4.0:
6693+
loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.4.0:
67066694
version "1.4.0"
67076695
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf"
67086696
integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==
@@ -7320,13 +7308,6 @@ [email protected]:
73207308
resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-2.2.1.tgz#90b617025a16381a879bc82a38d4e8bdeb2bcf45"
73217309
integrity sha512-gu9bD6Ta5bwGrrU8muHzVOBFFREpp2iRkVfhBJahwJ6p6Xw20SjT0MxLnwkjOibQmGSYhiUnf2FLe7k+jcFmGQ==
73227310

7323-
path-to-regexp@^1.7.0:
7324-
version "1.8.0"
7325-
resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-1.8.0.tgz#887b3ba9d84393e87a0a0b9f4cb756198b53548a"
7326-
integrity sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==
7327-
dependencies:
7328-
isarray "0.0.1"
7329-
73307311
path-type@^4.0.0:
73317312
version "4.0.0"
73327313
resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b"
@@ -8215,7 +8196,7 @@ react-ga@^3.3.1:
82158196
resolved "https://registry.yarnpkg.com/react-ga/-/react-ga-3.3.1.tgz#d8e1f4e05ec55ed6ff944dcb14b99011dfaf9504"
82168197
integrity sha512-4Vc0W5EvXAXUN/wWyxvsAKDLLgtJ3oLmhYYssx+YzphJpejtOst6cbIHCIyF50Fdxuf5DDKqRYny24yJ2y7GFQ==
82178198

8218-
react-is@^16.13.1, react-is@^16.6.0, react-is@^16.7.0:
8199+
react-is@^16.13.1, react-is@^16.7.0:
82198200
version "16.13.1"
82208201
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
82218202
integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==
@@ -8276,33 +8257,20 @@ react-refresh@^0.11.0:
82768257
resolved "https://registry.yarnpkg.com/react-refresh/-/react-refresh-0.11.0.tgz#77198b944733f0f1f1a90e791de4541f9f074046"
82778258
integrity sha512-F27qZr8uUqwhWZboondsPx8tnC3Ct3SxZA3V5WyEvujRyyNv0VYPhoBg1gZ8/MV5tubQp76Trw8lTv9hzRBa+A==
82788259

8279-
react-router-dom@^5.0.1:
8280-
version "5.3.4"
8281-
resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-5.3.4.tgz#2ed62ffd88cae6db134445f4a0c0ae8b91d2e5e6"
8282-
integrity sha512-m4EqFMHv/Ih4kpcBCONHbkT68KoAeHN4p3lAGoNryfHi0dMy0kCzEZakiKRsvg5wHZ/JLrLW8o8KomWiz/qbYQ==
8260+
react-router-dom@^6.4.2:
8261+
version "6.4.2"
8262+
resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-6.4.2.tgz#115b37d501d6d8ac870683694978c51c43e6c0d2"
8263+
integrity sha512-yM1kjoTkpfjgczPrcyWrp+OuQMyB1WleICiiGfstnQYo/S8hPEEnVjr/RdmlH6yKK4Tnj1UGXFSa7uwAtmDoLQ==
82838264
dependencies:
8284-
"@babel/runtime" "^7.12.13"
8285-
history "^4.9.0"
8286-
loose-envify "^1.3.1"
8287-
prop-types "^15.6.2"
8288-
react-router "5.3.4"
8289-
tiny-invariant "^1.0.2"
8290-
tiny-warning "^1.0.0"
8291-
8292-
8293-
version "5.3.4"
8294-
resolved "https://registry.yarnpkg.com/react-router/-/react-router-5.3.4.tgz#8ca252d70fcc37841e31473c7a151cf777887bb5"
8295-
integrity sha512-Ys9K+ppnJah3QuaRiLxk+jDWOR1MekYQrlytiXxC1RyfbdsZkS5pvKAzCCr031xHixZwpnsYNT5xysdFHQaYsA==
8296-
dependencies:
8297-
"@babel/runtime" "^7.12.13"
8298-
history "^4.9.0"
8299-
hoist-non-react-statics "^3.1.0"
8300-
loose-envify "^1.3.1"
8301-
path-to-regexp "^1.7.0"
8302-
prop-types "^15.6.2"
8303-
react-is "^16.6.0"
8304-
tiny-invariant "^1.0.2"
8305-
tiny-warning "^1.0.0"
8265+
"@remix-run/router" "1.0.2"
8266+
react-router "6.4.2"
8267+
8268+
8269+
version "6.4.2"
8270+
resolved "https://registry.yarnpkg.com/react-router/-/react-router-6.4.2.tgz#300628ee9ed81b8ef1597b5cb98b474efe9779b8"
8271+
integrity sha512-Rb0BAX9KHhVzT1OKhMvCDMw776aTYM0DtkxqUBP8dNBom3mPXlfNs76JNGK8wKJ1IZEY1+WGj+cvZxHVk/GiKw==
8272+
dependencies:
8273+
"@remix-run/router" "1.0.2"
83068274

83078275
83088276
version "5.0.1"
@@ -8579,11 +8547,6 @@ resolve-from@^5.0.0:
85798547
resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69"
85808548
integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==
85818549

8582-
resolve-pathname@^3.0.0:
8583-
version "3.0.0"
8584-
resolved "https://registry.yarnpkg.com/resolve-pathname/-/resolve-pathname-3.0.0.tgz#99d02224d3cf263689becbb393bc560313025dcd"
8585-
integrity sha512-C7rARubxI8bXFNB/hqcp/4iUeIXJhJZvFPFPiSPRnhU5UPxzMFIl+2E6yY6c4k9giDJAhtV+enfA+G89N6Csng==
8586-
85878550
resolve-url-loader@^4.0.0:
85888551
version "4.0.0"
85898552
resolved "https://registry.yarnpkg.com/resolve-url-loader/-/resolve-url-loader-4.0.0.tgz#d50d4ddc746bb10468443167acf800dcd6c3ad57"
@@ -9451,16 +9414,6 @@ thunky@^1.0.2:
94519414
resolved "https://registry.yarnpkg.com/thunky/-/thunky-1.1.0.tgz#5abaf714a9405db0504732bbccd2cedd9ef9537d"
94529415
integrity sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA==
94539416

9454-
tiny-invariant@^1.0.2:
9455-
version "1.3.1"
9456-
resolved "https://registry.yarnpkg.com/tiny-invariant/-/tiny-invariant-1.3.1.tgz#8560808c916ef02ecfd55e66090df23a4b7aa642"
9457-
integrity sha512-AD5ih2NlSssTCwsMznbvwMZpJ1cbhkGd2uueNxzv2jDlEeZdU04JQfRnggJQ8DrcVBGjAsCKwFBbDlVNtEMlzw==
9458-
9459-
tiny-warning@^1.0.0:
9460-
version "1.0.3"
9461-
resolved "https://registry.yarnpkg.com/tiny-warning/-/tiny-warning-1.0.3.tgz#94a30db453df4c643d0fd566060d60a875d84754"
9462-
integrity sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==
9463-
94649417
tmp@~0.2.1:
94659418
version "0.2.1"
94669419
resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.2.1.tgz#8457fc3037dcf4719c251367a1af6500ee1ccf14"
@@ -9775,11 +9728,6 @@ v8-to-istanbul@^8.1.0:
97759728
convert-source-map "^1.6.0"
97769729
source-map "^0.7.3"
97779730

9778-
value-equal@^1.0.1:
9779-
version "1.0.1"
9780-
resolved "https://registry.yarnpkg.com/value-equal/-/value-equal-1.0.1.tgz#1e0b794c734c5c0cade179c437d356d931a34d6c"
9781-
integrity sha512-NOJ6JZCAWr0zlxZt+xqCHNTEKOsrks2HQd4MqhP1qy4z1SkbEP467eNx6TgDKXMvUOb+OENfJCZwM+16n7fRfw==
9782-
97839731
vary@~1.1.2:
97849732
version "1.1.2"
97859733
resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"

0 commit comments

Comments
 (0)