Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

update a value from array in redux state

return { 
  ...state, 
  contents: state.contents.map(
      (content, i) => i === 1 ? {...content, text: action.payload}
                              : content
  )
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #update #array #redux #state
ADD COMMENT
Topic
Name
4+3 =