add hook for devices
This commit is contained in:
@@ -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;
|
||||
};
|
||||
Reference in New Issue
Block a user