Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1.  
  2. import { createStore, applyMiddleware, compose } from 'redux'
  3. import { routerMiddleware } from 'react-router-redux'
  4. import thunk from 'redux-thunk'
  5. import createHistory from 'history/createBrowserHistory'
  6. import rootReducer from './modules'
  7. // import { composeWithDevTools } from 'redux-devtools-extension'
  8.  
  9.  
  10. export const history = createHistory();
  11.  
  12. const initialState = {};
  13. const enhancers = [];
  14. const middleware = [
  15. thunk,
  16. routerMiddleware(history)
  17. ];
  18.  
  19. if (process.env.NODE_ENV === 'development') {
  20. const devToolsExtension = window.__REDUX_DEVTOOLS_EXTENSION__;
  21.  
  22. if (typeof devToolsExtension === 'function') {
  23. enhancers.push(devToolsExtension())
  24. }
  25. }
  26.  
  27. const composedEnhancers = compose(
  28. applyMiddleware(...middleware),
  29. ...enhancers
  30. );
  31.  
  32. const store = createStore(
  33. rootReducer,
  34. initialState,
  35. composedEnhancers
  36. );
  37.  
  38. export default store
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement