import { useEffect, useState } from "react";

const useIsTouchDevice = () => {
  const [isTouchDevice, setTouchDevice] = useState(false);
  useEffect(() => {
  // simple way to check whether the device support touch (it doesn't check all fallback, it supports only modern browsers)
    if (window !== undefined && "ontouchstart" in window) {
      setTouchDevice(true);
    }
  }, []);
  return isTouchDevice;
};

export default useIsTouchDevice;
