function attachRef(ref, component, owner) {
  if (typeof ref === 'function') {
    ref(component.getPublicInstance());
  } else {
    // Legacy ref
    ReactOwner.addComponentAsRefTo(component, ref, owner);
  }
}
Adds a component by ref to an owner component.

@param {ReactComponent} component Component to reference.
@param {string} ref Name by which to refer to the component.
@param {ReactOwner} owner Component on which to record the ref.
@final
@internal