August 2017
Beginner
374 pages
10h 41m
English
With JavaScript, we can simply overwrite the dispatch implementation of Redux with our own, as we did with the this.middleware function earlier in this chapter:
// DO NOT DO THISconst next = store.dispatchstore.dispatch = function dispatchAndLog (action) { if (console.group) console.group(action.type) console.info('dispatching', action) const result = next(action) console.log('new state', store.getState()) if (console.groupEnd) console.groupEnd(action.type) return result}
However, this is a bad solution, as it might break on future Redux updates. Furthermore, it is simply not a good API. It also does not work well when you want to combine multiple plugins, possibly causing conflicts.
Assume that we have ...
Read now
Unlock full access