Find and edit in array with map
props.setMembers([
...props.members.map((el, index) => {
if (el.id == props.editThisOne.id) {
el = member;
}
return el;
})
]);
this.setState(oldState => ({
todos: [
...oldState.todos.map((el, index) => {
if (el.id == todo.id) {
// el = todo;
el.completed = true;
}
return el;
})
]
}));