index.js 886 Bytes
Newer Older
1 2
import React from 'react';
import ReactDOM from 'react-dom';
3
import { createStore, applyMiddleware, compose } from 'redux'
baiguangyao committed
4
import { Provider } from 'react-redux'
zhanghaozhe committed
5
import { BrowserRouter as Router } from 'react-router-dom'
baiguangyao committed
6
import thunk from 'redux-thunk'
zhanghaozhe committed
7
import logger from 'redux-logger'
zhanghaozhe committed
8
import rootReducers from './store'
zhanghaozhe committed
9
import App from './App'
10 11


zhanghaozhe committed
12
const reduxDevToolOptions = process.env.REACT_APP_BUILD_ENV === 'production' ? {} : {trace: true, traceLimit: 25}
zhanghaozhe committed
13

zhanghaozhe committed
14
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ &&
zhanghaozhe committed
15
    window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__(reduxDevToolOptions) || compose;
16

zhanghaozhe committed
17
const store = createStore(
zhanghaozhe committed
18
    rootReducers,
19 20 21
    composeEnhancers(
        applyMiddleware(thunk, logger)
    )
zhanghaozhe committed
22 23
)

baiguangyao committed
24
ReactDOM.render(
zhanghaozhe committed
25
    <Provider store={store}>
zhanghaozhe committed
26 27 28
        <Router>
            <App/>
        </Router>
zhanghaozhe committed
29 30
    </Provider>,
    document.getElementById('root'));