I’m confused by this function which sets the state to zero. I think of state as an object including properties, so in my mind a state would need a key and value such as state = { count: 0 } .
const counterReducer = (state = 0, action) => { }
const counterReducer = (state = 0, action) => {
switch (action.type) {
case INCREMENT:
return (state += 1);
case DECREMENT:
return (state -= 1);
default:
return state;
}