Skip to content

Commit

Permalink
switched 15 and 21 to React Router 6
Browse files Browse the repository at this point in the history
  • Loading branch information
john-smilga committed Mar 27, 2022
1 parent dec6796 commit 731d90d
Show file tree
Hide file tree
Showing 9 changed files with 34,674 additions and 264 deletions.
4 changes: 4 additions & 0 deletions 15-cocktails/final/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@
"build": "CI= react-scripts build",
```

```sh
npm install react-router-dom@6
```
17,433 changes: 17,322 additions & 111 deletions 15-cocktails/final/package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion 15-cocktails/final/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"@testing-library/user-event": "^7.2.1",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-router-dom": "^5.2.0",
"react-router-dom": "^6.2.2",
"react-scripts": "3.4.3"
},
"scripts": {
Expand Down
34 changes: 13 additions & 21 deletions 15-cocktails/final/src/App.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,22 @@
import React from "react";
import { BrowserRouter as Router, Route, Switch } from "react-router-dom";
import React from 'react';
import { BrowserRouter as Router, Route, Routes } from 'react-router-dom';
// import pages
import Home from "./pages/Home";
import About from "./pages/About";
import SingleCocktail from "./pages/SingleCocktail";
import Error from "./pages/Error";
import Home from './pages/Home';
import About from './pages/About';
import SingleCocktail from './pages/SingleCocktail';
import Error from './pages/Error';
// import components
import Navbar from "./components/Navbar";
import Navbar from './components/Navbar';
function App() {
return (
<Router>
<Navbar />
<Switch>
<Route exact path="/">
<Home />
</Route>
<Route path="/about">
<About />
</Route>
<Route path="/cocktail/:id">
<SingleCocktail />
</Route>
<Route path="*">
<Error />
</Route>
</Switch>
<Routes>
<Route path='/' element={<Home />} />
<Route path='about' element={<About />} />
<Route path='cocktail/:id' element={<SingleCocktail />} />
<Route path='*' element={<Error />} />
</Routes>
</Router>
);
}
Expand Down
4 changes: 4 additions & 0 deletions 15-cocktails/setup/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@
"build": "CI= react-scripts build",
```

```sh
npm install react-router-dom@6
```
Loading

0 comments on commit 731d90d

Please sign in to comment.