Last active
October 18, 2017 02:58
-
-
Save nelreina/64bc4313d81990087c14a722dec9544c to your computer and use it in GitHub Desktop.
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 { combineReducers } from 'redux'; | |
export default combineReducers({ | |
default: (state ={}, action) => state | |
}) |
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, applyMiddleware } from 'redux'; | |
import { composeWithDevTools } from 'redux-devtools-extension'; | |
import thunk from 'redux-thunk'; | |
import rootReducer from './rootReducer'; | |
const logger = store => next => action => { | |
console.group(action.type); | |
console.info('dispaching', action); | |
const result = next(action); | |
console.log('next state', store.getState()); | |
console.groupEnd(action.type); | |
return result; | |
}; | |
export default (initialState = {}) => { | |
let enhancer; | |
const middelwares = applyMiddleware(thunk, logger); | |
enhancer = composeWithDevTools(middelwares); | |
return createStore(rootReducer, initialState, enhancer); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment