JSFiddle - React, Tailwind, and code Playground

by phsiao2000

HTML

<script src="http://fb.me/react-with-addons-0.8.0.js"></script>
<script src="http://fb.me/JSXTransformer-0.8.0.js"></script>
<script src="http://fb.me/react-js-fiddle-integration.js"></script>

JavaScript 1.7

/** @jsx React.DOM */

var ControlsTitle = {
  _updateTitle: function() {
      if (typeof this.getTitle === 'function')
          document.title = this.getTitle();
  },
  componentDidMount:  function() { this._updateTitle(); },
  componentDidUpdate: function() { this._updateTitle(); }
}

var Page = React.createClass({
  mixin: [ControlsTitle],
  render: function() { return this.props.children; }
 });

var Hello = React.createClass({
    render: function() {
        return <Page title="stuff">
                   <div>Hello {this.props.name}</div>
               </Page>;
    }
});
 
React.renderComponent(<Hello name="World" />, document.body);