Just remember that your reducer should return some kind of initial state if the state given to it as the first argument is undefined. But you don’t want your initial application state to be undefined, so you have to initialize the state yourself .11 Nis 2020
Read moreWhere do I put initial state Redux?
You can set it at the reducers . Reducers can also set initialState by looking at the incoming state argument (which would be undefined if createStore is not called with initialState ) and returning the values they would like to use as default.4 Ara 2016
Read moreWhere do I put initial state Redux?
You can set it at the reducers . Reducers can also set initialState by looking at the incoming state argument (which would be undefined if createStore is not called with initialState ) and returning the values they would like to use as default.4 Ara 2016
Read moreWhat is the purpose of adding initial state?
initialState is an object that contains different initial state values, and the states that the reducers need to act upon . The functions in reducers are like regular reducers that accept state and action as arguments.2 Ara 2021
Read more