Created
June 10, 2018 10:53
-
-
Save kiok46/a82c24a9572b6686010b4d803ac907a8 to your computer and use it in GitHub Desktop.
Redux, Store, Actions, Reducers and logger: Get Started and a little further (1)
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 { createStore, compose, applyMiddleware } from 'redux'; | |
import thunk from 'redux-thunk'; | |
import { createLogger } from 'redux-logger'; | |
import reducers from '../Reducers'; | |
const middleWare = []; | |
middleWare.push(thunk) | |
const loggerMiddleware = createLogger({ | |
predicate: () => process.env.NODE_ENV === 'development', | |
}); | |
middleWare.push(loggerMiddleware) | |
const store = createStore( | |
reducers, | |
{}, | |
compose( | |
applyMiddleware(...middleWare) | |
) | |
); | |
export default store; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment