JSFiddle - React, Tailwind, and code Playground

by Michael LaCroix

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>
<div id="app">APP PLACEHOLDER</div>

JavaScript 1.7

/** @jsx React.DOM */

var SampleComponent = React.createClass({
    cityElement: function() {
        var city = this.props.city;
        if ('Chicago' === city)
            return <strong>City: {city}</strong>;
        return <em>City: {city}</em>;
    },
    render: function() {
        return this.cityElement();
    }
});

React.renderComponent(<SampleComponent city="Chicago" />, document.getElementById('app'));

setTimeout(function() {
    React.renderComponent(<SampleComponent city="Nashville" />, document.getElementById('app'));
}, 5000);