Skip to content

Instantly share code, notes, and snippets.

@StevenJL
Created October 1, 2018 16:41
Show Gist options
  • Save StevenJL/3d3a91e164f0b444cd109977a0f70eee to your computer and use it in GitHub Desktop.
Save StevenJL/3d3a91e164f0b444cd109977a0f70eee to your computer and use it in GitHub Desktop.
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