import React__default from 'react';

/*
* useForwardedRef allows a forwarded ref within
* React.forwardRef to be made available at the
* component applying the ref.
*/

function useForwardedRef(ref) {
  var innerRef = React__default.useRef(null);
  React__default.useEffect(function () {
    if (!ref) return; // Handle function refs

    if (ref instanceof Function) {
      ref(innerRef.current);
    } else {
      ref.current = innerRef.current;
    }
  });
  return innerRef;
}

export { useForwardedRef as default };
