Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

react redux cheat sheet

// Reducer
function counter (state = { value: 0 }, action) {
  switch (action.type) {
  case 'INCREMENT':
    return { value: state.value + 1 }
  case 'DECREMENT':
    return { value: state.value - 1 }
  default:
    return state
  }
}
Source by devhints.io #
 
PREVIOUS NEXT
Tagged: #react #redux #cheat #sheet
ADD COMMENT
Topic
Name
7+5 =