In the past, I have implemented a logging middleware for the store. For reference, you can check out this example: https://github.com/Webiks/angular-redux-middleware-example.
Essentially, this middleware captures all actions, allowing you to either manipulate them based on the actions or pass them onto the next function for the store to proceed.
export function loggerMiddleware(store) {
return function (next) {
return function (action) {
// Displaying a message and action log
console.log('Hello, this is your captain speaking.', action);
// Proceed to the next action
return next(action);
};
};
}
You could also rewrite it as follows to make it more concise:
export const loggerMiddleware = store => next => action {
// Displaying a message and action log
console.log('Hello, this is your captain speaking.', action);
// Proceed to the next action
return next(action);
};
};
}