Skip to content

Instantly share code, notes, and snippets.

@tolmasky
Created October 14, 2014 01:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tolmasky/6534ed664716ac38d471 to your computer and use it in GitHub Desktop.
Save tolmasky/6534ed664716ac38d471 to your computer and use it in GitHub Desktop.
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