add hook for devices

This commit is contained in:
sebvtl728
2025-01-03 01:03:52 +01:00
parent 021afc7925
commit 8fcd728887
2 changed files with 38 additions and 144 deletions
@@ -0,0 +1,14 @@
import { useEffect, useState } from "react";
export const useIsTouchDevice = () => {
const [isTouchDevice, setIsTouchDevice] = useState(false);
useEffect(() => {
const checkTouchDevice = () => {
setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
};
checkTouchDevice();
}, []);
return isTouchDevice;
};