Skip to content

Commit

Permalink
add Switch
Browse files Browse the repository at this point in the history
  • Loading branch information
koretskiyav committed Oct 29, 2021
1 parent 1ae3e10 commit 36ee8d7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/components/app/app.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { PureComponent } from 'react';
import { Route } from 'react-router-dom';
import { Route, Switch } from 'react-router-dom';
import Restaurants from '../restaurants';
import Header from '../header';
import Basket from '../basket';
Expand All @@ -9,8 +9,12 @@ export default class App extends PureComponent {
return (
<div>
<Header />
<Route path="/checkout" component={Basket} />
<Route path="/restaurants/:restId" component={Restaurants} />
<Switch>
<Route path="/" exact component={() => <h2>Home page</h2>} />
<Route path="/checkout" component={Basket} />
<Route path="/restaurants/:restId" component={Restaurants} />
<Route component={() => <h2>404 - Not found :(</h2>} />
</Switch>
</div>
);
}
Expand Down

0 comments on commit 36ee8d7

Please sign in to comment.