JSFiddle - React, Tailwind, and code Playground

by jonase

HTML

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

CSS

svg {
    border: 1px solid black;
}

JavaScript 1.7

/** @jsx React.DOM */

var Hello = React.createClass({
    getInitialState: function() {
       return {x:10, y:10, width:40, height:40};
    },
    handleClick: function(evt) {
        console.log(evt);
        this.setState({x:evt.clientX, y:evt.clientY});
    },
    render: function() {
        return (
          <svg onClick={this.handleClick}>
            <rect x={this.state.x}
                  y={this.state.y}
                  width={this.state.width}
                  height={this.state.height}/>
          </svg>
        );
    }
});
 
React.renderComponent(<Hello name="World" />, document.body);