Previously, the middleware exported three string constants. One each for the pending, fulfilled and rejected action types. This is useful for reducers, for example:
constreducer=(state ={}, action)=>{
switch(action.type){
case`FOO_${PENDING}`:
// ..
β
case`FOO_${FULFILLED}`:
// ...
β
default:return state;
}
}
This is a nice affordance, it could be better design if the action types were exported as an enum (E.g., an object, since this is just JavaScript), as opposed three individual strings.
Using action types is entirely optional. One one hand, code benefits from more robust types and is less prone to static errors, but, on another hand, you and your team spends more time and effort writing the code.
At the end of the day, you can also just use regular strings like any other action.