I am learning react-redux at the moment, already grasped the basics (I believe), I am now trying to create a notification array on my state that can be populated by several actions.
But since is a notification, I only want to add a notification after each of those actions is completed (the state is changed).
I thought about using a middleware class but that would add the notification into array before the action is computed on the reduce.
Quick example:
User logins -> dispatch action -> affects state property related to login -> adds a notification on the notification array
User adds item -> dispatch action -> affects state property related to items -> adds a notification on the notification array
These are 2 different actions, I could in the if logic of each action (on reducer) update the notification array, but seems like repeated code and I would be creating notification object on a reducer, is that okay?
So in this case where should I dispatch the action of adding a notification to the notification array?
I am looking for best practices