August 2017
Beginner
374 pages
10h 41m
English
A better approach would be to write a function that will dispatch and log an action:
function dispatchAndLog (store, action) { if (console.group) console.group(action.type) console.info('dispatching', action) store.dispatch(action) console.log('new state', store.getState()) if (console.groupEnd) console.groupEnd(action.type)}
Then, we could use it like this:
dispatchAndLog(store, addPost('hello world'))
However, it's still not very convenient to use this function instead of dispatch everywhere.
Read now
Unlock full access