How to update single value inside specific array item in redux

The Solution to How to update single value inside specific array item in redux is


You can use map. Here is an example implementation:

case 'SOME_ACTION':
   return { 
       ...state, 
       contents: state.contents.map(
           (content, i) => i === 1 ? {...content, text: action.payload}
                                   : content
       )
    }

~ Answered on 2016-02-25 14:15:27


Most Viewed Questions: