Order of multiple middleware in React Redux
The middleware pipeline exactly matches the order that you passed to applyMiddleware()
. So, in that example:
- calling
store.dispatch()
passes the action tomiddle
- when
middle1
callsnext(action)
, it goes tomiddle2
- when
middle2
callsnext(action)
, it goes tomiddle3
- when
middle3
callsnext(action)
, it goes to the actual store and the reducer logic is executed
And no, you cannot reorder middleware after the store has been created.