React Base Fiddle (JSX)

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

by gabs00

HTML

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

JavaScript 1.7

var Card = React.createClass({
    randomFunc: function(){
        this.props.bg = "yellow";
    },
    render: function () {
        var defaults = {
            width: '400',
            height: '280',
            bg: '#00F999'
        };
        for (var prop in defaults) {
            if (this.props[prop] === undefined) {
                this.props[prop] = defaults[prop];
            }
        }

        var style = {
            height: this.props.height,
            width: this.props.width,
            background: this.props.bg,
            borderRadius: '10px',
            boxShadow: '2px 2px 10px grey'
        }
        return (
            <div style={style} className={this.props.className}
            onClick={this.randomFunc}>
            </div>
        );
  }
});

React.render(<Card className="pie" /> , document.body);