Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ```javascript
- const addLoggingToDispatch = (store) => {
- const rawDispatch = store.dispatch;
- return (action) => {
- console.group(action.type);
- console.log('prev state', store.getState());
- console.log('action', action);
- const returnValue = rawDispatch(action);
- console.log('next state', store.getState());
- console.groupEnd(action.type);
- return returnValue;
- }
- }
- ```
- and later in your code
- ```javascript
- store.dispatch = addLoggingToDispatch(store);
- ```
Add Comment
Please, Sign In to add comment