The Wayback Machine - https://web.archive.org/web/20200917004852/https://github.com/rehooks/window-size
Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
Oct 25, 2018
Oct 25, 2018
Oct 25, 2018
Oct 25, 2018
Oct 25, 2018
Oct 25, 2018
Oct 25, 2018
Oct 25, 2018
Oct 25, 2018
Oct 25, 2018
Oct 25, 2018

README.md

@rehooks/window-size

React hook for subscribing to window size

Note: This is using the new React Hooks API Proposal which is subject to change until React 16.7 final.

You'll need to install react, react-dom, etc at ^16.7.0-alpha.0

Install

yarn add @rehooks/window-size

Usage

import useWindowSize from '@rehooks/window-size';

function MyComponent() {
  let windowSize = useWindowSize();
  // {
  //   innerWidth: window.innerWidth,
  //   innerHeight: window.innerHeight,
  //   outerWidth: window.outerWidth,
  //   outerHeight: window.outerHeight,
  // }

  // ...
}
You can’t perform that action at this time.