Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

update a value from array in redux state

case 'SOME_ACTION':
   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
2+9 =