How to use the redux-zero/middleware.applyMiddleware function in redux-zero

To help you get started, we’ve selected a few redux-zero examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github axetroy / blog / src / redux / store.js View on Github external
FOLLOWERS: [], // 关注我的人
  SHOW_CASES: [], // 项目展示
  TODO: {}, // Todo详情
  TODOS: [], // Todo列表
  TODO_LABELS: [], // Todo的标签列表
  REPO: {}, // 仓库详情
  REPOS: [], // 仓库列表
  POST: {}, // 文章详情
  POSTS: [], // 文章列表
  STACKOVERFLOW: {}, // 踩坑详情
  STACKOVERFLOWS: [], // 踩坑列表
  GIST: {}, // Gist的详情
  GISTS: [] // Gist列表
};

const middlewares = applyMiddleware(
  logger(),
  persist({ key: "[rz]", storage: localForage }, function(err, state) {
    if (err) {
      console.error(err);
    } else {
      store.setState(state);
    }
  })
);

const store = createStore(initialState, middlewares);

export default store;

redux-zero

<h1 align="center"> <img src="https://i.imgur.com/S8jnr8O.png" height="300px" alt="redux zero logo" title="redux zero logo"> <br> </h1> <p align="center" style="font-size: 1.2rem;">A lightweight state container based on Redux</p>

MIT
Latest version published 4 years ago

Package Health Score

60 / 100
Full package analysis