antd-npm-demo
Version:
React & Redux & Ant.Design
17 lines (14 loc) • 360 B
JavaScript
import { SET_COUNTER, INCREMENT_COUNTER, DECREMENT_COUNTER } from '../actions'
const counter = (state = 0, action) => {
switch (action.type) {
case SET_COUNTER:
return action.payload
case INCREMENT_COUNTER:
return state + 1
case DECREMENT_COUNTER:
return state - 1
default:
return state
}
}
export default counter