Created
April 30, 2021 14:25
-
-
Save erictherobot/a582652db0e9043464fc248bd9b0d3b4 to your computer and use it in GitHub Desktop.
Window Size Hook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useScreen } from '@/hooks/useScreen'; | |
interface WindowSize { | |
width: number; | |
height: number; | |
} | |
export function useWindowSize(): WindowSize { | |
const screen = useScreen(); | |
return { | |
width: screen?.width || 0, | |
height: screen?.height || 0, | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment