Tell us what’s happening:
Your code so far
const INCREMENT = 'INCREMENT'; // define a constant for increment action types
const DECREMENT = 'DECREMENT'; // define a constant for decrement action types
const defaultState = 0;
const counterReducer=(state=defaultState, action)=>{
switch(action.type){
case INCREMENT:
state++;
case DECREMENT:
state--;
default:
return state;
}
}; // define the counter reducer which will increment or decrement the state based on the action it receives
const incAction = () => { return {type: INCREMENT}};
const decAction = () => { return {type: DECREMENT}};
const store = Redux.createStore(counterReducer);
console.log(store.getState());
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64; rv:64.0) Gecko/20100101 Firefox/64.0
.
Link to the challenge: