Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

react redux how to change object value in reducer

  if (action.type == types.FILTER_TITLE_CHANGED) {
    let newState = { ...state };
    newState.filterTitleStr = action.filterTitleStr;
    return newState;
  } else if (action.type == types.FILTER_AUTHOR_CHANGED) {
    let newState = { ...state };
    newState.filterAuthorStr = action.filterAuthorStr;
    return newState;
  } else if (action.type == types.FILTER_CATEGORY_CHANGED) {
    let newState = { ...state };
    newState.filterCategoryStr = action.filterCategoryStr;
    return newState;
  }
 
PREVIOUS NEXT
Tagged: #react #redux #change #object #reducer
ADD COMMENT
Topic
Name
2+1 =