const reducer = (state = initialState, action) => { switch (action.type) { case "BUY_CAKE": return { numOfCakes: state.numOfCakes - 1, }; default: return state; } };