React - Load Initial List via AJAX


I'm starting to learn react. There's an excellent example in the official docs about loading data initially via AJAX:

var UserGist = React.createClass({
    getInitialState: function() {
        return {
            username: '',
            lastGistUrl: ''

    componentDidMount: function() {
        this.serverRequest = $.get(this.props.source, function (result) {
            var lastGist = result[0];
                username: lastGist.owner.login,
                lastGistUrl: lastGist.html_url

    componentWillUnmount: function() {

    render: function() {
        return (
                {this.state.username}'s last gist is
                <a href={this.state.lastGistUrl}>here</a>.

    <UserGist source="" />,

The code above gets the latest gist of a specific user from GitHub.

What is the best way in React to go about outputting a list of the last 10 gists of the specific user?

How would you modify the code sample above?

By : Muzzstick

This video can help you solving your question :)
By: admin