How to reset the state of a Redux store?

前端 未结 30 2361
陌清茗
陌清茗 2020-11-22 06:20

I am using Redux for state management.
How do I reset the store to its initial state?

For example, let’s say I have two user accounts (u1 and

30条回答
  •  长发绾君心
    2020-11-22 06:34

    I've created a component to give Redux the ability of resetting state, you just need to use this component to enhance your store and dispatch a specific action.type to trigger reset. The thought of implementation is same as what @Dan Abramov said.

    Github: https://github.com/wwayne/redux-reset

提交回复
热议问题