update object with spread operator
var state = {
id: 1,
points: 100,
name: "Goran"
};
var newState = {
...state,
points: 120
}
console.log(newState);
/*
{
id: 1,
points: 120,
name: "Goran"
}
*/
Are there any code examples left?
New code examples in category Other