Skip to content

Instantly share code, notes, and snippets.

@mariusk
Created October 30, 2015 01:14
Show Gist options
  • Save mariusk/722d00a39908198a73c6 to your computer and use it in GitHub Desktop.
Save mariusk/722d00a39908198a73c6 to your computer and use it in GitHub Desktop.
let Start = React.createClass({
childContextTypes: {
user: React.PropTypes.object
},
getChildContext: function() {
return this.state;
},
getInitialState: function() {
return {user: null};
},
componentDidMount: function() {
AppState.get('user').subscribe(user => {
this.setState({user: user});
});
},
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment