-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRoutes copy.js
More file actions
executable file
·41 lines (38 loc) · 1.12 KB
/
Routes copy.js
File metadata and controls
executable file
·41 lines (38 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import React from "react";
import pages from "./data/pages";
import FavoriteRecipeList from "./components/FavoriteRecipeList";
import MyMemes from "./components/MyMemes";
import { AnimatePresence } from "framer-motion";
import { Switch, Route, useLocation } from "react-router-dom";
import App from "./components/App";
import Header from "./components/Header";
function Routes() {
const location = useLocation();
return (
<AnimatePresence>
<Switch location={location} key={location.key}>
<Route exact path="/">
<Header title="Home" />
<App />
</Route>
<Route path="/favorite-recipes">
<Header title="Favorite Recipes" />
<FavoriteRecipeList />
</Route>
<Route path="/my-memes">
<Header title="My Memes" />
<MyMemes />
</Route>
{pages.map((page, index) => {
return (
<Route index={index} path={page.path}>
<Header title={page.name} />
{page.component}
</Route>
);
})}
</Switch>
</AnimatePresence>
);
}
export default Routes;