Last active
September 15, 2016 18:54
-
-
Save panw/3f8e86a78dda482d2c881ee2f5690dae to your computer and use it in GitHub Desktop.
React ES5 Timeline Component
This file contains hidden or 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
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