@reach/window-size
TypeScript icon, indicating that this package has built-in type declarations

0.18.0 • Public • Published

@reach/window-size

Stable release MIT license

Docs | Source

Measure the current window dimensions.

import WindowSize, { useWindowSize } from "@reach/window-size";

function Example() {
	const { width, height } = useWindowSize();
	return (
		<div>
			<p>
				Looks like a pretty{" "}
				{width <= 400 ? "small" : width >= 1000 ? "large" : "normal"} screen!
			</p>
		</div>
	);
}

Dependents (12)

Package Sidebar

Install

npm i @reach/window-size

Weekly Downloads

28,605

Version

0.18.0

License

MIT

Unpacked Size

12.9 kB

Total Files

10

Last publish

Collaborators

  • ryanflorence
  • mjackson
  • chancestrickland
  • blainekasten