Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

redux reducer

const reducer = (state = initialState, action) => {
  switch (action.type) {
    case "BUY_CAKE":
      return {
        numOfCakes: state.numOfCakes - 1,
      };
    default:
      return state;
  }
};
Source by redux.js.org #
 
PREVIOUS NEXT
Tagged: #redux #reducer
ADD COMMENT
Topic
Name
9+9 =