This repository has been archived by the owner on Oct 26, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 648
/
app.js
50 lines (44 loc) · 1.52 KB
/
app.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
import { createDevTools } from 'redux-devtools';
import LogMonitor from 'redux-devtools-log-monitor';
import DockMonitor from 'redux-devtools-dock-monitor';
const React = require('react');
const ReactDOM = require('react-dom');
const { applyMiddleware, compose, createStore, combineReducers } = require('redux');
const { Provider } = require('react-redux');
const { Router, Route, IndexRoute } = require('react-router');
const createHistory = require('history/lib/createHashHistory');
const { syncHistory, routeReducer } = require('redux-simple-router');
const reducers = require('./reducers');
const { App, Home, Foo, Bar } = require('./components');
const history = createHistory();
const middleware = syncHistory(history);
const reducer = combineReducers(Object.assign({}, reducers, {
routing: routeReducer
}));
const DevTools = createDevTools(
<DockMonitor toggleVisibilityKey='ctrl-h'
changePositionKey='ctrl-q'>
<LogMonitor theme='tomorrow' />
</DockMonitor>
);
const finalCreateStore = compose(
applyMiddleware(middleware),
DevTools.instrument()
)(createStore);
const store = finalCreateStore(reducer);
middleware.listenForReplays(store);
ReactDOM.render(
<Provider store={store}>
<div>
<Router history={history}>
<Route path="/" component={App}>
<IndexRoute component={Home}/>
<Route path="foo" component={Foo}/>
<Route path="bar" component={Bar}/>
</Route>
</Router>
<DevTools />
</div>
</Provider>,
document.getElementById('mount')
);