React Base Fiddle (JSX)
Starting point for creating JSFiddles with React. This uses React with Addons.
by sstur
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"></div>
JavaScript 1.7
var Hello = React.createClass({
componentDidMount: function() {
this.isMounted = true;
},
componentWillUnmount: function() {
this.isMounted = false;
},
render: function() {
return <div>Hello {this.props.name}</div>;
}
});
var node = document.getElementById('container');
var thing = React.render(
<Hello name="World" />,
node
);
setTimeout(function() {
console.log('isMounted', thing.isMounted);
React.unmountComponentAtNode(node);
console.log('isMounted', thing.isMounted);
React.unmountComponentAtNode(node);
}, 400);