Created
November 29, 2017 17:30
-
-
Save brybrophy/f2b8696f75117890edd4a249b8dd7cb4 to your computer and use it in GitHub Desktop.
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
import React, { Component } from 'react'; | |
import { action, observable } from 'mobx'; | |
import { observer } from 'mobx-react'; | |
@observer | |
export default class User extends Component { | |
@observable user = { | |
firstName: 'john', | |
lastName: 'lennon', | |
status: 'alive' | |
}; | |
@action updateUserStatus(newStatus) { | |
this.user.status = newStatus | |
} | |
render() { | |
const { firstName, lastName, status } = this; | |
return ( | |
<p>{firstName} {lastName} - {status}</p> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment