daily pastebin goal
62%
SHARE
TWEET

Untitled

a guest Nov 22nd, 2017 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { createStore, applyMiddleware } from 'redux';
  2. import thunk from 'redux-thunk';
  3. import createLogger from 'redux-logger';
  4.  
  5. import reducers from '../reducers';
  6.  
  7. const inBrowser = typeof window === 'object';
  8. const middleware = [
  9.   thunk,
  10.   createLogger({
  11.     predicate: () => inBrowser && process.env.NODE_ENV !== 'production',
  12.     collapsed: true
  13.   })
  14. ];
  15.  
  16. export default function configureStore(initialState) {
  17.   const store = createStore(
  18.     reducers,
  19.     initialState,
  20.     applyMiddleware(...middleware)
  21.   );
  22.  
  23.   return store;
  24. }
RAW Paste Data
Top