-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
51 lines (40 loc) · 1.5 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
import React from 'react';
import {render} from 'react-dom';
import thunkMiddleware from 'redux-thunk';
import {createStore, applyMiddleware, combineReducers} from 'redux';
import {Provider} from 'react-redux';
import reducers from './reducers/reducers';
import {Router, Route, IndexRoute, Link} from 'react-router';
import {syncHistory, routeReducer} from 'react-router-redux';
import createHistory from 'history/lib/createBrowserHistory';
let browserHistory = createHistory();
import Apps from './containers/app.js';
let rootElement = document.getElementById('app');
// Sync dispatched route actions to the history
const reduxRouterMiddleware = syncHistory(browserHistory);
const createStoreWithMiddleware = applyMiddleware(
reduxRouterMiddleware,
thunkMiddleware
)(createStore);
//const createStoreWithMiddleware = applyMiddleware(
// thunkMiddleware
//)(createStore);
const store = createStoreWithMiddleware(
reducers,
window.devToolsExtension ? window.devToolsExtension() : undefined
);
reduxRouterMiddleware.listenForReplays(store);
console.log('store', store.getState());
import styles from './asset/styles/CitiesSettingsPage/CitiesSettings.css';
import AddCityPage from './components/CitiesSettings/AddCityPage';
render(
<Provider store={store}>
<Router history={browserHistory}>
<Route path="/" component={Apps}>
<Route path="addCity" component={AddCityPage}>
</Route>
</Route>
</Router>
</Provider>,
rootElement
);