-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
38 lines (34 loc) · 1.4 KB
/
index.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
import React from 'react';
import ReactDOM from 'react-dom';
import { ItemList, Footer, NotFound } from './components';
import registerServiceWorker from './registerServiceWorker';
import { Provider } from 'react-redux';
import { Route, Switch } from 'react-router';
import createHistory from 'history/createBrowserHistory';
import thunk from 'redux-thunk';
import reducers from './reducers';
import { createStore, applyMiddleware, combineReducers } from 'redux';
import { ConnectedRouter, routerReducer, routerMiddleware } from 'react-router-redux';
import 'semantic-ui-css/semantic.min.css';
import './index.css';
const history = createHistory();
const historyMiddleware = routerMiddleware(history);
const store = createStore(combineReducers({
...reducers,
routing: routerReducer
}), applyMiddleware(thunk, historyMiddleware));
ReactDOM.render(
<Provider store={store}>
<div>
<ConnectedRouter history={history}>
<Switch>
<Route exact path={process.env.PUBLIC_URL + '/'} component={ItemList}/>
<Route path={process.env.PUBLIC_URL + '/pokemon/:Id'} component={ItemList}/>
<Route path={process.env.PUBLIC_URL + '/not_found_404'} component={NotFound}/>
</Switch>
</ConnectedRouter>
<Footer />
</div>
</Provider>,
document.getElementById('root'));
registerServiceWorker();