Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions src/components/App.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Fragment, useEffect, useState } from 'react'
import { BrowserRouter as Router, Route } from 'react-router-dom'
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'

import Header from './Header'
import Sidebar from './Sidebar'
Expand Down Expand Up @@ -47,11 +47,15 @@ const App = () => {
<div className="content">
<Sidebar />
<main className="main">
<Route exact path="/" component={NewSnippet} />
<Route exact path="/recent" component={RecentSnippets} />
<Route exact path="/:id([a-zA-Z0-9]+)" component={Snippet} />
<Route exact path="/about" component={About} />
<Route exact path="/sign-in" component={SignIn} />
<Switch>
<Route exact path="/" component={NewSnippet} />
<Route exact path="/about" component={About} />
<Route exact path="/recent" component={RecentSnippets} />
<Route exact path="/sign-in" component={SignIn} />
// Switch renders the first matched route, so we need to keep this
// one last as the regexp below matches the paths of other pages
<Route exact path="/:id([a-zA-Z0-9]+)" component={Snippet} />
</Switch>
</main>
</div>
</Fragment>
Expand Down