Skip to content

Commit 19f450a

Browse files
committed
refactor: update to react-router v6
1 parent 265132a commit 19f450a

1 file changed

Lines changed: 8 additions & 17 deletions

File tree

src/index.js

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*/
1818
import React from "react";
1919
import ReactDOM from "react-dom/client";
20-
import { BrowserRouter, Route, Switch, Redirect } from "react-router-dom";
20+
import { BrowserRouter, Route, Routes, Navigate } from "react-router-dom";
2121

2222
import "assets/css/nucleo-icons.css";
2323
import "assets/scss/blk-design-system-react.scss";
@@ -32,21 +32,12 @@ const root = ReactDOM.createRoot(document.getElementById("root"));
3232

3333
root.render(
3434
<BrowserRouter>
35-
<Switch>
36-
<Route path="/components" render={(props) => <Index {...props} />} />
37-
<Route
38-
path="/landing-page"
39-
render={(props) => <LandingPage {...props} />}
40-
/>
41-
<Route
42-
path="/register-page"
43-
render={(props) => <RegisterPage {...props} />}
44-
/>
45-
<Route
46-
path="/profile-page"
47-
render={(props) => <ProfilePage {...props} />}
48-
/>
49-
<Redirect from="/" to="/components" />
50-
</Switch>
35+
<Routes>
36+
<Route path="/components" element={<Index />} />
37+
<Route path="/landing-page" element={<LandingPage />} />
38+
<Route path="/register-page" element={<RegisterPage />} />
39+
<Route path="/profile-page" element={<ProfilePage />} />
40+
<Route path="*" element={<Navigate to="/components" replace />} />
41+
</Routes>
5142
</BrowserRouter>
5243
);

0 commit comments

Comments
 (0)