Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

react useState update object in array of objects

this.setState({items: this.state.items.map(x => x.id === someId ? {...x, attr:'val'} : x)});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #react #useState #update #object #array #objects
ADD COMMENT
Topic
Name
7+5 =