-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
43 lines (35 loc) · 1.02 KB
/
index.js
File metadata and controls
43 lines (35 loc) · 1.02 KB
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
// -*- coding: utf-8 -*-
// -*- mode: react -*-
// @flow
import React from 'react'
import { render } from 'react-dom'
import Sitemap from './sitemap.js'
import { Provider } from 'react-redux'
import thunkMiddleware from 'redux-thunk'
import { Router, Route, hashHistory } from 'react-router'
import { syncHistoryWithStore, routerReducer } from 'react-router-redux'
import { createStore, combineReducers, applyMiddleware } from 'redux'
import appReducer from 'icon-pool/reducers/app.reducer.js'
/**
* Combine all the reducer.
*/
const store = createStore(
combineReducers({
app: appReducer,
routing: routerReducer
}),
applyMiddleware(
thunkMiddleware
)
)
const mountNode = id => document.getElementById(id)
const history = syncHistoryWithStore(hashHistory, store)
const wrapper = rootRoute => (
<Provider store={store}>
<Router history={history}>
{rootRoute}
</Router>
</Provider>
)
render(wrapper(Sitemap), mountNode('main'))
let unsubscribe = store.subscribe(_ => console.log(store.getState()))