Created
October 1, 2018 16:41
-
-
Save StevenJL/3d3a91e164f0b444cd109977a0f70eee to your computer and use it in GitHub Desktop.
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
class User extends React.Component { | |
// ... | |
updateUserStatus(status) { | |
const { user } = this.state; | |
setState({ user: {...user, status: status }}) | |
} | |
appendItem(newItem) { | |
const { items } = this.state | |
setState({ items: [...items, newItem ] }) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment