File tree Expand file tree Collapse file tree 3 files changed +27
-19
lines changed
Expand file tree Collapse file tree 3 files changed +27
-19
lines changed Original file line number Diff line number Diff line change @@ -3,14 +3,16 @@ import './App.css';
33
44import Layout from './Layout/Layout' ;
55
6- import { BrowserRouter as Router } from 'react-router-dom' ;
6+ import { BrowserRouter } from 'react-router-dom' ;
77const App : React . FC = ( ) => {
88 return (
9- < div >
10- < Router >
11- < Layout />
12- </ Router >
13- </ div >
9+ < React . StrictMode >
10+ < div >
11+ < BrowserRouter >
12+ < Layout />
13+ </ BrowserRouter >
14+ </ div >
15+ </ React . StrictMode >
1416 ) ;
1517} ;
1618
Original file line number Diff line number Diff line change 11import React from 'react' ;
2- import { Switch , Route } from 'react-router-dom' ;
2+ import { Routes , Route } from 'react-router-dom' ;
33import { examplesList } from '../examples/examplesList' ;
44
55const PageContent = ( ) => {
66 return (
77 < div className = "content-page" >
8- < Switch >
8+ < Routes >
99 { examplesList . map ( ( item ) => (
10- < Route key = { item . name } exact = { item . exact } path = { item . path } >
11- < React . Fragment >
12- < h1 > { item . name } </ h1 >
13- { < item . component /> }
14- </ React . Fragment >
15- </ Route >
10+ < Route
11+ key = { item . name }
12+ path = { item . path }
13+ element = {
14+ < >
15+ < h1 > { item . name } </ h1 >
16+ { < item . component /> }
17+ </ >
18+ }
19+ > </ Route >
1620 ) ) }
17- </ Switch >
21+ </ Routes >
1822 </ div >
1923 ) ;
2024} ;
Original file line number Diff line number Diff line change 1- import React from 'react' ;
1+ import React , { FC } from 'react' ;
22import List from '@mui/material/List' ;
33import ListItem from '@mui/material/ListItem' ;
44import ListItemText from '@mui/material/ListItemText' ;
55import { Link } from 'react-router-dom' ;
66import { examplesList } from '../examples/examplesList' ;
7- import { withRouter , RouteProps } from 'react-router' ;
7+ import { useLocation } from 'react-router' ;
8+
9+ const Sidebar : FC = ( ) => {
10+ const location = useLocation ( ) ;
811
9- const Sidebar = ( { location } : RouteProps ) => {
1012 return (
1113 < div className = "sidebar" >
1214 < List disablePadding dense >
@@ -26,4 +28,4 @@ const Sidebar = ({ location }: RouteProps) => {
2628 ) ;
2729} ;
2830
29- export default withRouter ( Sidebar ) ;
31+ export default Sidebar ;
You can’t perform that action at this time.
0 commit comments