Why do I get “Reducer […] returned undefined during initialization” despite providing initialState to createStore()?

后端 未结 7 2262
死守一世寂寞
死守一世寂寞 2020-12-13 08:27

I had set InitialState in my redux createStore method ,and I corresponding InitialState as second arguments

I got a error in browser:

Un         


        
7条回答
  •  伪装坚强ぢ
    2020-12-13 08:44

    Also, make sure that you are returning the default state last in your reducer. Sometimes you can forget to make sure this is the default for your switch statement (when refactoring and moving around code).

    ...
     default:
      return state
    

提交回复
热议问题