25 lines
597 B
JavaScript
25 lines
597 B
JavaScript
// Rekit uses a new approach to organizing actions and reducers. That is
|
|
// putting related actions and reducers in one file. See more at:
|
|
// https://medium.com/@nate_wang/a-new-approach-for-managing-redux-actions-91c26ce8b5da
|
|
|
|
import { EXAMPLES_COUNTER_MINUS_ONE } from './constants';
|
|
|
|
export function counterMinusOne() {
|
|
return {
|
|
type: EXAMPLES_COUNTER_MINUS_ONE,
|
|
};
|
|
}
|
|
|
|
export function reducer(state, action) {
|
|
switch (action.type) {
|
|
case EXAMPLES_COUNTER_MINUS_ONE:
|
|
return {
|
|
...state,
|
|
count: state.count - 1,
|
|
};
|
|
|
|
default:
|
|
return state;
|
|
}
|
|
}
|