Created
April 27, 2016 16:47
-
-
Save oliversisson/d4a912eb12351f95bf1d7d4eefbe0639 to your computer and use it in GitHub Desktop.
Improvement to setMessageStatus. It is much more terse. It is more functional: using a map, rather than a for-loop
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
setMessageStatus(uniqueId, status) { | |
return this.state.messages.map(function(message) { | |
if (message.uniqueId !== uniqueId) { | |
return message; | |
} | |
return Object.assign({}, message, {status}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment