Skip to content

Files

Latest commit

5728cc9 Β· Oct 28, 2018

History

History
21 lines (15 loc) Β· 319 Bytes

useWindowSize.md

File metadata and controls

21 lines (15 loc) Β· 319 Bytes

useWindowSize

React sensor hook that tracks dimensions of the browser window.

Usage

import {useWindowSize} from 'react-use';

const Demo = () => {
  const {width, height} = useWindowSize();

  return (
    <div>
      <div>width: {width}</div>
      <div>height: {height}</div>
    </div>
  );
};