Tell us what’s happening:
Error “Dispatching decAction on the Redux store should decrement the state by 1.”.
The problem seems stupid, but I can not understand, what is wrong with the code and why decremention does not work.
Your code so far
const INCREMENT = null; // define a constant for increment action types
const DECREMENT = null; // define a constant for decrement action types
const counterReducer = (state=0, action) =>{
switch (action.type) {
case INCREMENT:
return state+1;
break;
case DECREMENT:
return state-1;
break;
default:
return state;
break
};
}; // define the counter reducer which will increment or decrement the state based on the action it receives
const incAction = () => {return {type: INCREMENT}}; // define an action creator for incrementing
const decAction = () => {return {type: DECREMENT}}; // define an action creator for decrementing
const store = Redux.createStore(counterReducer); // define the Redux store here, passing in your reducers
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:64.0) Gecko/20100101 Firefox/64.0
.
Link to the challenge: