Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5a0dce7

Browse files
refactor: updated routing to use react-router-dom v6 api
1 parent e951caf commit 5a0dce7

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed

‎src/App.tsx‎

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,26 @@
11
import React from 'react'
2-
import { BrowserRouter as Router, Switch, Route, Link } from 'react-router-dom'
2+
import { BrowserRouter as Router, Routes, Route, Link } from 'react-router-dom'
33

44
import '@/styles/app.scss'
55

66
import { NavBar, Modal } from '@/components/shared'
77
import { Home, Algorithms, About } from '@/pages'
88

9-
const App: React.FC = () => {
10-
return (
11-
<div className='app'>
12-
<Router>
13-
<NavBar>
14-
<Link to='/algorithms'>ALGORITHMS</Link>
15-
<Link to='/about'>ABOUT</Link>
16-
</NavBar>
17-
<Modal />
18-
<Switch>
19-
<Route exact path='/algorithms' component={Algorithms} />
20-
<Route exact path='/about' component={About} />
21-
<Route exact path='/' component={Home} />
22-
</Switch>
23-
</Router>
24-
</div>
25-
)
26-
}
9+
const App: React.FC = () => (
10+
<div className='app'>
11+
<Router>
12+
<NavBar>
13+
<Link to='/algorithms'>ALGORITHMS</Link>
14+
<Link to='/about'>ABOUT</Link>
15+
</NavBar>
16+
<Modal />
17+
<Routes>
18+
<Route path='/algorithms' element={<Algorithms />} />
19+
<Route path='/about' element={<About />} />
20+
<Route path='/' element={<Home />} />
21+
</Routes>
22+
</Router>
23+
</div>
24+
)
2725

2826
export default App

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /