React Base Fiddle (JSX)

Starting point for creating JSFiddles with React. This uses React with Addons.

by hairinwind

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.13.1/JSXTransformer.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.13.1/react-with-addons.js"></script>
<script src="https://facebook.github.io/react/js/jsfiddle-integration.js"></script>

<div id="container">
    <!-- This element's contents will be replaced with your component. -->
</div>

JavaScript 1.7

var UserGist = React.createClass({
  getInitialState: function() {
    return {
        //user: {}
        user:{address:{}}
    };
  },

  componentDidMount: function() {
    $.get(this.props.source, function(result) {
      var lastGist = result[0];
      if (this.isMounted()) {
        var state = {
            user:{address:{name: lastGist.owner.login}}
        };
        this.setState(state);
      }
    }.bind(this));
  },

  render: function() {
    return (
      <div>
        {this.state.user.address.name}'s last gist is
        <a href={this.state.user.address.name}>here</a>.
      </div>
    );
  }
});

React.render(
  <UserGist source="http://api.github.com/users/octocat/gists" />,
  container
);