Skip to content

Instantly share code, notes, and snippets.

@dustin-H
Created July 27, 2015 20:52
Show Gist options
  • Select an option

  • Save dustin-H/a636d9589b993212b16a to your computer and use it in GitHub Desktop.

Select an option

Save dustin-H/a636d9589b993212b16a to your computer and use it in GitHub Desktop.
class Blog extends React.Component{
constructor(){
super();
this.state = {
text: ''
}
}
componentDidMount(){
superagent.get('/getpost')
.end(function(err, data){
this.setState({text: data.text});
})
}
render(){
return(
<div>{this.state.text}</div>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment