Created
January 14, 2019 18:16
-
-
Save ramsunvtech/8942a40bb8fcf902997e4e43410d5d08 to your computer and use it in GitHub Desktop.
Redux Logger
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { compose, createStore, applyMiddleware } from 'redux'; | |
import { Provider } from 'react-redux'; | |
import thunkMiddleware from 'redux-thunk'; | |
const middlewares = [ | |
thunkMiddleware, | |
]; | |
if (process.env.NODE_ENV !== 'production') { | |
const createLogger = require('redux-logger'); | |
middlewares.push(createLogger()); | |
} | |
const store = createStore(rootReducer, | |
undefined, | |
compose( | |
applyMiddleware(...middlewares)), | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment