-
Notifications
You must be signed in to change notification settings - Fork 9
/
App.tsx
33 lines (29 loc) · 1010 Bytes
/
App.tsx
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
import React from 'react';
import { BrowserRouter, Route, Switch } from 'react-router-dom';
import { Footer } from './components/Footer';
import { Header } from './components/Header';
import { StateContext } from './context';
import { HomePage } from './pages/HomePage';
import { NotFoundPage } from './pages/NotFoundPage';
import { initialState, reducer } from './store/reducer';
function App() {
const [state, dispatch] = React.useReducer(reducer, initialState);
return (
<div className="App">
<div className="container">
<BrowserRouter>
<StateContext.Provider value={{ ...state, dispatch }}>
<Header />
<Switch>
<Route exact path="/" component={HomePage} />
<Route exact path="/tags/:name" component={HomePage} />
<Route component={NotFoundPage} />
</Switch>
<Footer />
</StateContext.Provider>
</BrowserRouter>
</div>
</div>
);
}
export default App;