Skip to content

Instantly share code, notes, and snippets.

@panw
Last active September 15, 2016 18:54
Show Gist options
  • Save panw/3f8e86a78dda482d2c881ee2f5690dae to your computer and use it in GitHub Desktop.
Save panw/3f8e86a78dda482d2c881ee2f5690dae to your computer and use it in GitHub Desktop.
React ES5 Timeline Component
const Timeline = React.createClass({
getInitialState: function() {
return { tweets: [] };
},
componentDidMount: function() {
this.fetchTweets();
},
fetchTweets: function() {
$.ajax({
url: '/tweets/recent',
method: 'GET'
})
.done(function(response) {
this.setState({
tweets: response
})
}.bind(this))
},
render: function() {
return (
<section>
<ul>
<Tweet />
</ul>
</section>
)
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment