Last active
December 2, 2019 14:57
-
-
Save rodrigograca31/6a1920ca50312190918788beab5ddbce to your computer and use it in GitHub Desktop.
Find and edit in array with map
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
}) | |
] | |
})); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment