React Base Fiddle (JSX)
Starting point for creating JSFiddles with React. This uses React with Addons.
by qfox
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>
JavaScript 1.7
var data = {
caption: "Cap",
people: [ 'John', 'Malkovich', 'Doe' ]
};
var TemplateRT = React.createClass({
render: function() {
var data = this.props;
return <div>
{data.caption ? data.caption + ': ' : ''}
{data.people.map(function(person, personIndex, people) {
return person +
(personIndex < people.length - 1 ? ', ' : '');
})}
</div>;
}
});
React.render(<TemplateRT caption={data.caption} people={data.people} />, document.getElementById('container'));