React Base Fiddle (JSX)

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

by zpao

HTML

<script src="http://fb.me/JSXTransformer-0.13.0-rc1.js"></script>
<script src="http://fb.me/react-with-addons-0.13.0-rc1.js"></script>
<script src="http://facebook.github.io/react/js/jsfiddle-integration.js"></script>

JavaScript 1.7

var Hello = React.createClass({
  statics: {
    foo: function() {
      console.log('foo');
      // In 0.12, we re-bound each function in statics to the constructor as a result of the legacy factory code. So calling Hello.foo from any point was safe. This broke from typical JS and from typical "Static" conventions. We really just fixed it.
      console.log(this.baz);
      this.bar();
    },
    bar: function() {
      console.log('bar');
    },
    baz: 'qux'
  },
  render: function() {
    return (
      <div>
        Open your console and...<br/>
        <a href="#" onClick={Hello.foo}>Click me and watch me break in 0.13.</a><br/>
        <a href="#" onClick={Hello.foo.bind(Hello)}>Click me and watch me work in both</a>
      </div>
    );
  }
});

React.render(<Hello name="World" />, document.body);