why is this so difficult to do or find an answer for?
I have my state
state: {
people: [
{name: 'tom'},
{name: 'rich'},
]
}
why is it so hard to update the name Tom to Pete for example?
const people = this.state.people.slice();
people[i].name = value;
this.setState({ people });
I can do this but 1) i
is undefined and 2) it just seems messy
is there not a more elegant solution to update object keys??