Skip to content

Instantly share code, notes, and snippets.

@friej715
Created November 25, 2015 03:10
Show Gist options
  • Save friej715/7e39feea0aca7784b03a to your computer and use it in GitHub Desktop.
Save friej715/7e39feea0aca7784b03a to your computer and use it in GitHub Desktop.
a part of a tweet deleter
var Page = React.createClass({
getInitialState: function() {
return {
tweets: {},
}
},
componentDidMount: function() {
$.get("http://localhost:3000/tweets", function(data) {
var d = data[0];
console.log(d)
if (this.isMounted()) {
this.setState({tweets: d})
}
}.bind(this))
},
render: function() {
console.log(this.state.tweets)
return (
<div></div>
)
}
})
ReactDOM.render(
<Page/>, document.getElementById("main")
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment