Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

react-use-window-size

danielkhoo634MIT1.0.1TypeScript support: included

Custom React Hook to get width of the browser window

React, Hooks, Custom Hooks, Window Size, Window Width, Window Height

readme

useWindowSize - Custom React Hook

A custom React Hook to get the window dimensions including resizing.

Useful for implementing responsive behavior, modifying elements for different screen sizes.

Install

$ npm install react-use-window-size

Usage

import useWindowSize from './useWindowSize';

const { width, height } = useWindowSize();

console.log(width, height); //Current window size i.e. 1366 768

License

MIT