I'm curious, I've seen in middlewares, such as redux-promise-middleware
where we want a single action to fire off multiple actions (e.g. REQUEST, SUCCESS, FAILURE). However, in the middleware, we're provided the dispatch
to be able to dispatch
these actions. Is there a reason for calling these additional actions with next(action)
over the dispatch(action)
?
If you dispatch an action then it will go through all of the middleware chain again. On the other hand next just sends it along to the next middleware in the chain or straight to the reducers if there aren't any more middlewares.