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.
22 lines
419 B
22 lines
419 B
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; |
|
} |
|
}
|
|
|