Open coryschadt opened 4 years ago
Create a hook that detects screen size. Similar to this, but allow for props
export const useIsSmallDevice = () => { const [width, setWidth] = useState(window.innerWidth) const [height, setHeight] = useState(window.innerHeight) useEffect(() => { const updateSize = () => { setWidth(window.innerWidth) setHeight(window.innerHeight) } window.addEventListener("resize", updateSize) return () => window.removeEventListener("resize", updateSize) }, []) return width < 767 || height < 500 }
Create a hook that detects screen size. Similar to this, but allow for props