import { useEffect, useState } from "react";
export const useHeight = ref => {
  const [height, setHeight] = useState(0);
  useEffect(() => {
    if (ref && ref.current) {
      const element = ref.current;
      const prevMaxHeight = element.style.maxHeight;
      const prevVisibility = element.style.visibility;
      element.style.visibility = "hidden";
      element.style.maxHeight = "none";
      const elementHeight = element.clientHeight;
      element.style.visibility = prevVisibility;
      element.style.maxHeight = prevMaxHeight;
      return setHeight(elementHeight);
    }
  }, [ref]);
  return height;
};
//# sourceMappingURL=useHeight.js.map