examples/02-redux/src/reducers/counter.js
function counter(state = 0, action = {}) {
  switch (action.type) {
    case INCREMENT_COUNTER:
      return state + 1;
    case DECREMENT_COUNTER:
      return state - 1;
    default:
      return state;
  }
}
function counter(state = 0, action = {}) {
  switch (action.type) {
    case INCREMENT_COUNTER:
      return state + 1;
    case DECREMENT_COUNTER:
      return state - 1;
    default:
      return state;
  }
}
function counter ( state = 0 , action = { } ) { switch ( action . type ) { case INCREMENT_COUNTER : return state + 1 ; case DECREMENT_COUNTER : return state - 1 ; default : return state ; } }
reducer for the counter
@param  {number} state  input state
@param  {object} action object containing the action type
@param  {string} action.type action type
@return {number}
reducer for the counter