Files
plusMinusSet/lab07/src/reducer.js
2025-06-23 17:07:56 +02:00

18 lines
465 B
JavaScript

const initialState = {
count: 100,
fifeTHousend: 5000,
};
export default function reducer(state = initialState, action) {
switch (action.type) {
case "count/increaseBy":
return { ...state, count: state.count + action.amount };
case "count/decreaseBy":
return { ...state, count: state.count - action.amount };
case "count/setToFiveThousand":
return { ...state, count: state.fifeTHousend };
default:
return state;
}
}