BREAKING: Migrate to Store Enhancer API
This release removes the special snowflake createOfflineStore
method in favor of Redux store enhancers. This will get us better interoperability with other redux libraries, and paves way to "universal" Redux Offline that can be used with frameworks likes Vue and Angular.
This release also contains the bugfixes released as v1.1.0 earlier today. If you are migrating from 1.0.x, check that change log for a full list of improvements and fixes.
Migration guide
The changes are simple, and limited to your store creation logic:
- Instead of
createOfflineStore
, import theoffline
store enhancer fromredux-offline
- Instead of
createOfflineStore
, use the default reduxcreateStore
- Instead of passing the offline config as the last argument to
createOfflineStore
, pass it to theoffline
store enhancer - If using other middleware/enhancers, use
compose
from redux to compose the offline enhancer with them
-import { applyMiddleware } from 'redux';
+import { applyMiddleware, createStore, compose } from 'redux';
// import the "offline" store enhancer instead of createOfflineStore
- import { createOfflineStore } from 'redux-offline'
+import { offline } from 'redux-offline';
import offlineConfig from 'redux-offline/lib/defaults';
// ...
-const store = createOfflineStore(
+const store = createStore(
reducer,
preloadedState,
- applyMiddleware(middleware),
- offlineConfig
+ compose(
+ applyMiddleware(middleware),
+ offline(offlineConfig)
+ )
);
Thank you @migueloller and @gaearon for contributing to this release! 🎉