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>
JavaScript 1.7
var If = React.createClass({
render: function() {
if (this.props.test) {
return this.props.children;
}
else {
return false;
}
}
});
var App = React.createClass({
render: function () {
return (
<div id="page">
<If test={this.props.banner}>
{alert('This code is executed even though this.props.banner is undefined')}
<div id="banner">{this.props.banner.url}</div>
</If>
<div id="other-content">
blah blah blah...
</div>
</div>
);
}
});
React.render(<App />, document.body);