-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
41 lines (36 loc) · 1.12 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
import React from 'react';
import ReactDOM from 'react-dom';
import { createStore, combineReducers, applyMiddleware } from 'redux';
import { Provider } from 'react-redux';
import { Router, Route } from 'react-router';
import { syncHistoryWithStore, routerReducer } from 'react-router-redux';
import thunk from 'redux-thunk';
import { BrowserRouter } from 'react-router-dom';
import './css/main.css';
import 'bootstrap/dist/css/bootstrap.css';
import 'bootstrap/dist/css/bootstrap-theme.css';
import reducers from './reducers';
import getRoutes from './routes';
import { appStart } from './actions';
const middleware = [thunk];
// Add the reducer to your store on the `routing` key
const store = createStore(
combineReducers({
...reducers,
routing: routerReducer
}),
applyMiddleware(...middleware),
);
window.onload = function() {
store.dispatch(appStart(() => {
ReactDOM.render(
<Provider store={store}>
{ /* Tell the Router to use our enhanced history */ }
<BrowserRouter>
{getRoutes(store)}
</BrowserRouter>
</Provider>,
document.getElementById('root')
);
}));
};