github.com/stampzilla/stampzilla-go@v2.0.0-rc9+incompatible/nodes/stampzilla-magicmirror/web/src/store.js (about)

     1  import { createStore, applyMiddleware, compose } from 'redux'
     2  import { routerMiddleware } from 'connected-react-router/immutable'
     3  import thunk from 'redux-thunk'
     4  import createHistory from 'history/createBrowserHistory'
     5  import rootReducer from './ducks'
     6  import { Map } from 'immutable'
     7  
     8  export const history = createHistory()
     9  
    10  const initialState = Map({})
    11  const enhancers = []
    12  const middleware = [thunk, routerMiddleware(history)]
    13  
    14  if (process.env.NODE_ENV === 'development') {
    15    const devToolsExtension = window.__REDUX_DEVTOOLS_EXTENSION__
    16  
    17    if (typeof devToolsExtension === 'function') {
    18      enhancers.push(devToolsExtension())
    19    }
    20  }
    21  
    22  const composedEnhancers = compose(
    23    applyMiddleware(...middleware),
    24    ...enhancers
    25  )
    26  
    27  export default createStore(
    28    rootReducer(history),
    29    initialState,
    30    composedEnhancers
    31  )