You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
419 B
23 lines
419 B
7 years ago
|
import * as types from '../actions/actionTypes';
|
||
|
|
||
|
const initialState = {
|
||
|
count: 0
|
||
|
};
|
||
|
|
||
|
export default function counter(state = initialState, action = {}) {
|
||
|
switch (action.type) {
|
||
|
case types.INCREMENT:
|
||
|
return {
|
||
|
...state,
|
||
|
count: state.count + 1
|
||
|
};
|
||
|
case types.DECREMENT:
|
||
|
return {
|
||
|
...state,
|
||
|
count: state.count - 1
|
||
|
};
|
||
|
default:
|
||
|
return state;
|
||
|
}
|
||
|
}
|