function useHover(ref:MutableRefObject<any>) {
const [hovered, setHovered] = useState(false)
useEffect(()=>{
if (ref.current == null) return
const handlerOver = () => setHovered(true)
const handlerOut = () => setHovered(false)
ref.current.addEventListener("pointerover", handlerOver)
ref.current.addEventListener("pointerout", handlerOut)
return () => {
ref.current.removeEventListener("pointerover", handlerOver)
ref.current.removeEventListener("pointerout", handlerOut)
};
},[ref.current])
return hovered
}