Answer the question
In order to leave comments, you need to log in
How to get the initial state of the reducer?
How to get the initial state of the reducer?
Here is an example code, but for some reason it doesn't work
const initialState = {
message : false,
key: null
}
const notification = (state = initialState , action) => {
switch( action.type ){
case "UPDATE_NOTIFICATION":
return Object.assign({}, state, action.payload );
case "RESET_NOTIFICATION":
return initialState;
default : return state;
}
}
export default notification;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question