Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var Reduction = React.createClass(
{
render: function() {
var self = this;
return <div><Child isParentMounted = { function() { return self.isMounted(); } } /></div>;
},
componentDidMount: function() { console.log("actually mounted."); }
});
var Child = React.createClass(
{
render: function() { return <div>{ this.props.isParentMounted() ? "yes" : "no" }</div>; },
componentDidMount: function()
{
console.log("this should surely be no: " + (this.props.isParentMounted() ? "yes" : "no"));
}
});
var test = React.renderComponent(<Reduction />, document.getElementById("container"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment