Skip to content

Instantly share code, notes, and snippets.

@erictherobot
Created April 30, 2021 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erictherobot/a582652db0e9043464fc248bd9b0d3b4 to your computer and use it in GitHub Desktop.
Save erictherobot/a582652db0e9043464fc248bd9b0d3b4 to your computer and use it in GitHub Desktop.
Window Size Hook
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