How to reset the state of a Redux store?

前端 未结 30 2586
陌清茗
陌清茗 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:39

    for me what worked the best is to set the initialState instead of state:

      const reducer = createReducer(initialState,
      on(proofActions.cleanAdditionalInsuredState, (state, action) => ({
        ...initialState
      })),
    

提交回复
热议问题