React Base Fiddle (JSX)

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

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.13.1/JSXTransformer.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.13.1/react-with-addons.js"></script>
<script src="https://facebook.github.io/react/js/jsfiddle-integration.js"></script>
<div id="container">
    <!-- This element's contents will be replaced with your component. -->
</div>

CSS

.light-it-up {
    background-color: indianred;
    color: white;
}

JavaScript 1.7

var initialItems = [
{id: 1, highlighted: false, text: "item1"},
{id: 2, highlighted: true, text: "item2"},
{id: 3, highlighted: false, text: "item3"},
];


var MyComponent = React.createClass({
    render: function() {
        return <div className={this.props.highlighted ? 'light-it-up' : ''}>{this.props.text}</div>;
    }
});


var MyList = React.createClass({
    getInitialState: function() {
        return { items: this.props.initialItems };
    },
    
    toggleHighlight: function() {
        var newItems = this.state.items.map(function (item) {
            item.highlighted = !item.highlighted;
            return item;
        });
        
        this.setState({ items: newItems });
    },
    
    render: function() {
        return (
            <div>
                <button onClick={this.toggleHighlight}>Toggle highlight</button>
                { this.state.items.map(function(item) {
                    return <MyComponent key={item.id} text={item.text} highlighted={item.highlighted}/>;
                }) }
            </div>
        );    
    }
});
 
React.render(<MyList initialItems={initialItems}/>, document.getElementById('container'));