Files
ProxMenux/AppImage/hooks/use-mobile.tsx
2025-11-09 13:12:51 +01:00

24 lines
459 B
TypeScript

"use client"
import { useEffect, useState } from "react"
export function useIsMobile() {
const [isMobile, setIsMobile] = useState(false)
useEffect(() => {
const checkMobile = () => {
setIsMobile(window.innerWidth < 768)
}
// Check on mount
checkMobile()
// Listen for resize
window.addEventListener("resize", checkMobile)
return () => window.removeEventListener("resize", checkMobile)
}, [])
return isMobile
}