Upgrade from 5.x to 6.0.0
This version includes changes to the public API, making it easier to import and use the middleware.
New: Preconfigured by Default
Before
Previously, the middleware need to be instantiated with an optional configuration.
This implementation enabled custom configuration, but, for most implementations, it is uncessary overhead.
After
Now, the default export is preconfigured and ready to go.
The middleware still supports custom configuration: import createPromise
and pass in the configuration object.
New: ActionType
Export
ActionType
ExportBefore
Previously, the middleware exported three string constants. One each for the pending, fulfilled and rejected action types. This is useful for reducers, for example:
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.
After
Now, the action types are exported as one enum.
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.
Last updated