Last active
June 11, 2017 19:24
-
-
Save coryhouse/d0c620b7bcc97538cfdb16cc7ad40eb0 to your computer and use it in GitHub Desktop.
Update state using Object.assign
This file contains hidden or 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
updateState(event) { | |
const {name, value} = event.target; | |
let user = Object.assign({}, this.state.user); | |
user[name] = value; | |
return this.setState({user}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment