Skip to content

@technobuddha > react-hooks > React > Hooks

Function: useWindowSize()

ts
function useWindowSize(): ScrollbarSize & {
  height: number;
  width: number;
} & {
  count: number;
};

Defined in: use-window-size.ts:16

Gets the current window size, including the dimensions of the scroll bars.

Also returns a count property, which increments each time the window is resized (since mount).

Returns

ScrollbarSize & { height: number; width: number; } & { count: number; }

width, height, scrollbarWidth, scrollbarHeight, count