According to this blog post and this entry , the call to MyComp no longer returns an instance, it returns a light handle.
Anti-pattern:
var MyComponent = React.createClass({ customMethod: function() { return this.props.foo === 'bar'; }, render: function() { } }); var component = <MyComponent foo="bar" />; component.customMethod(); // invalid use!
Proper use:
var MyComponent = React.createClass({ customMethod: function() { return this.props.foo === 'bar'; }, render: function() { } }); var realInstance = React.renderComponent(<MyComponent foo="bar" />, root); realInstance.customMethod(); // this is valid
Felix kling
source share