const createStore = require("redux-zero")
const applyMiddleware = require("redux-zero/middleware")
const persist = require("redux-zero-persist");
const persistMiddleware = persist({ key: "[key]", storage: require("localforage") }, function(
err,
state
) {
if (err) {
console.error(err);
} else {
store.setState(state);
}
});
const middlewares = applyMiddleware(
persistMiddleware,
antoherMiddleware
);
const store = createStore(initialState, middlewares);
如果你觉得项目不错,不要吝啬你的 star.
长期造轮子,欢迎 follow.
Axetroy 💻 🐛 🎨 |
---|