-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
57 lines (42 loc) · 1.25 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import React from 'react';
import ReactDOM from 'react-dom';
import { createStore, applyMiddleware, compose } from 'redux';
import { Provider } from 'react-redux';
import thunk from 'redux-thunk';
//import createHistory from 'history/createBrowserHistory';
import createHashHistory from 'history/createHashHistory';
import { Route } from 'react-router';
import { ConnectedRouter, routerMiddleware } from 'react-router-redux';
import reducer from './reducers';
import './index.css';
import App from './App';
import registerServiceWorker from './registerServiceWorker';
const history = createHashHistory();
const enhancers = [];
const middleware = [
thunk,
routerMiddleware(history),
];
if (process.env.NODE_ENV !== 'production') {
const devToolsExtension = window.devToolsExtension;
if (typeof devToolsExtension === 'function') {
enhancers.push(devToolsExtension());
}
}
const composedEnhancers = compose(
applyMiddleware(...middleware),
...enhancers,
);
const store = createStore(
reducer,
composedEnhancers
);
ReactDOM.render(
<Provider store={store}>
<ConnectedRouter history={history}>
<Route path="/:userpdf?" component={App}/>
</ConnectedRouter>
</Provider>,
document.getElementById('root')
);
registerServiceWorker();