Skip to content

Instantly share code, notes, and snippets.

@nelreina
Last active October 18, 2017 02:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nelreina/64bc4313d81990087c14a722dec9544c to your computer and use it in GitHub Desktop.
Save nelreina/64bc4313d81990087c14a722dec9544c to your computer and use it in GitHub Desktop.
import { combineReducers } from 'redux';
export default combineReducers({
default: (state ={}, action) => state
})
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