Better way of editing certain fields in a json object? Better way of editing certain fields in a json object? json json

Better way of editing certain fields in a json object?


the term you want is computed property keys. They will do exactly what you need:

return {  ...state,  expFormErrors: {    ...state.expFormErrors,    [action.fieldInStringFormat]: action.payload.fieldError  }};