-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
44 lines (40 loc) · 1.34 KB
/
App.js
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
42
43
44
import { Route } from "react-router-dom";
import { CSSTransition } from "react-transition-group";
import NotFound from "./pages/404";
import Access from "./pages/Access";
import Dashboard from "./pages/Dashboard";
import Institutions from "./pages/Institutions";
import Landing from "./pages/Landing";
import Posts from "./pages/Posts";
import Profiles from "./pages/Profiles";
import Stocks from "./pages/Stocks";
const routes = [
{ path: "/", name: "Home", Component: Landing },
{ path: "/access", name: "Access", Component: Access },
{ path: "/confidential", name: "Confidential", Component: Dashboard },
{ path: "/users", name: "Users", Component: Profiles },
{ path: "/posts", name: "Posts", Component: Posts },
{ path: "/stocks", name: "Stocks", Component: Stocks },
{ path: "/institutions", name: "Institutions", Component: Institutions },
];
function App() {
return (
<>
{routes.map(({ path, Component, name }) => (
<Route key={name} path={path} exact>
{({ match }) => (
<CSSTransition in={match != null} timeout={500} classNames="page" unmountOnExit>
<div className="page">
<Component />
</div>
</CSSTransition>
)}
</Route>
))}
<Route path={"/*"}>
<NotFound />
</Route>
</>
);
}
export default App;