JSFiddle - React, Tailwind, and code Playground

by evan

HTML

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

<div id="secret"></div>

<div id="displayed"></div>

CSS

#secret {
    display: none;
}

JavaScript 1.7

/** @jsx React.DOM */

var copyDOM = function () {
        //var html = this.getDOMNode().parentElement.innerHTML;
        //document.getElementById('displayed').innerHTML = html;
        
        document.body.appendChild(this.getDOMNode());
    };

var Hello = React.createClass({

    getInitialState: function () {
        return {
            clicks: 0
        };
    },

    handleClick: function () {
        this.setState({
            clicks: this.state.clicks + 1
        });
    },

    render: function() {
        return <div onClick={this.handleClick}>Clicked {this.state.clicks} times!</div>;
    },
    
    componentDidMount: copyDOM,    
    componentDidUpdate: copyDOM
});
 
React.renderComponent(<Hello name="World" />, document.getElementById('secret'));