diff --git a/src/core/ReactComponent.js b/src/core/ReactComponent.js index 530a6f9c66..d312881068 100644 --- a/src/core/ReactComponent.js +++ b/src/core/ReactComponent.js @@ -564,6 +564,22 @@ var ReactComponent = { */ isOwnedBy: function(owner) { return this.props[OWNER] === owner; + }, + + /** + * Gets another component, that shares the same owner as this one, by ref. + * + * @param {string} ref of a sibling Component. + * @return {?ReactComponent} the actual sibling Component. + * @final + * @internal + */ + getSiblingByRef: function(ref) { + var owner = this.props[OWNER]; + if (!owner || !owner.refs) { + return null; + } + return owner.refs[ref]; } }