import { useState, useCallback } from 'react';
import useIntersectionObserver from "../useIntersectionObserver/index.js";
const useIsVisible = function useIsVisible(opts = {}) {
  const [isVisible, setIsVisible] = useState(false);
  const callback = useCallback(entry => {
    setIsVisible(entry.isIntersecting);
  }, []);
  const ref = useIntersectionObserver({
    callback,
    ...opts
  });
  return {
    ref,
    isVisible
  };
};
export default useIsVisible;