redux-devtools/extension/examples/saga-counter/src/reducers/index.js

13 lines
288 B
JavaScript
Raw Normal View History

export default function counter(state = 0, action) {
switch (action.type) {
case 'INCREMENT':
return state + 1;
case 'INCREMENT_IF_ODD':
return state % 2 !== 0 ? state + 1 : state;
case 'DECREMENT':
return state - 1;
default:
return state;
}
}