Extends the store functionality by providing a middle layer between dispatched actions and the store’s reducer.
Before an action is given to a reducer, middleware have an opportunity to handle it themselves. They may dispatch their own actions, transform the current action, or block it entirely.
Middleware can also be used to set up external hooks from services.See more
public protocol Middleware