File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change 11import React , { Fragment , useEffect , useState } from 'react'
2- import { BrowserRouter as Router , Route } from 'react-router-dom'
2+ import { BrowserRouter as Router , Route , Switch } from 'react-router-dom'
33
44import Header from './Header'
55import Sidebar from './Sidebar'
@@ -47,11 +47,15 @@ const App = () => {
4747 < div className = "content" >
4848 < Sidebar />
4949 < main className = "main" >
50- < Route exact path = "/" component = { NewSnippet } />
51- < Route exact path = "/recent" component = { RecentSnippets } />
52- < Route exact path = "/:id([a-zA-Z0-9]+)" component = { Snippet } />
53- < Route exact path = "/about" component = { About } />
54- < Route exact path = "/sign-in" component = { SignIn } />
50+ < Switch >
51+ < Route exact path = "/" component = { NewSnippet } />
52+ < Route exact path = "/about" component = { About } />
53+ < Route exact path = "/recent" component = { RecentSnippets } />
54+ < Route exact path = "/sign-in" component = { SignIn } />
55+ // Switch renders the first matched route, so we need to keep this
56+ // one last as the regexp below matches the paths of other pages
57+ < Route exact path = "/:id([a-zA-Z0-9]+)" component = { Snippet } />
58+ </ Switch >
5559 </ main >
5660 </ div >
5761 </ Fragment >
You can’t perform that action at this time.
0 commit comments