组件的数据来源, 通常是通过 AJAX 请求从服务器获取, 可以使用 componentDidMount 方法设置 AJAX 请求, 等到请求成功, 再用this.setState()方法重新渲染 UI.

var UserGist = React.createClass({
  getInitialState(){
    return {
      userName: '',
      lastGistUrl: ''
    }
  },

  componentDidMounted(){
    $.get(this.props.source, function(result){
      var lastGist = result[0];
      if(this.isMouted()){
        this.setState({
          userName: lastGist.owner.login,
          lastGistUrl: lastGist.html_url
        });
      }
    }.bind(this));
  },

  render(){
    return (
      <div>
        {this.state.userName}'s last Gist is
        <a href={this.state.lastGistUrl}>here</a>
      </div>
    );
  }
});

React.render(
  <UserGist source= '....' />, document.body
)