-
Notifications
You must be signed in to change notification settings - Fork 178
Expand file tree
/
Copy pathApp.js
More file actions
49 lines (43 loc) · 1.51 KB
/
App.js
File metadata and controls
49 lines (43 loc) · 1.51 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
42
43
44
45
46
47
48
49
import React, { Suspense } from "react";
import { Link, Route, Switch } from "wouter";
import Header from "components/Header";
import Register from 'pages/Register'
import Login from "pages/Login";
import SearchResults from "pages/SearchResults";
import Detail from "pages/Detail";
import ErrorPage from "pages/ErrorPage";
import { UserContextProvider } from "context/UserContext";
import { GifsContextProvider } from "context/GifsContext";
import "./App.css";
const HomePage = React.lazy(() => import("./pages/Home"));
export default function App () {
return (
<UserContextProvider>
<div className="App">
<Suspense fallback={null}>
<section className="App-content">
<Header />
<Link to="/">
<figure className="App-logo">
<img alt="Giffy logo" src="/logo.png" />
</figure>
</Link>
<GifsContextProvider>
<Switch>
<Route component={HomePage} path="/" />
<Route
component={SearchResults}
path="/search/:keyword/:rating?/:lang?"
/>
<Route component={Detail} path="/gif/:id" />
<Route component={Login} path="/login" />
<Route component={Register} path="/register" />
<Route component={ErrorPage} path="/:rest*" />
</Switch>
</GifsContextProvider>
</section>
</Suspense>
</div>
</UserContextProvider>
);
}