new ReactOwner()
ReactOwners are capable of storing references to owned components.
All components are capable of //being// referenced by owner components, but
only ReactOwner components are capable of //referencing// owned components.
The named reference is known as a "ref".
Refs are available when mounted and updated during reconciliation.
var MyComponent = React.createClass({
render: function() {
return (
);
},
handleClick: function() {
this.refs.custom.handleClick();
},
componentDidMount: function() {
this.refs.custom.initialize();
}
});
Refs should rarely be used. When refs are used, they should only be done to
control data that is not handled by React's data flow.
- Source: