# react-window-size-hook

> A React hook that re-renders a component when the browser window is resized.

Latest version **1.0.3** (published 2020-04-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-window-size-hook
pnpm add react-window-size-hook
yarn add react-window-size-hook
bun add react-window-size-hook
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2020-04-13 |
| First published | 2020-04-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Carlos Zanella |
| Maintainers | zanella |

## Links

- npm: https://www.npmjs.com/package/react-window-size-hook
- npm.io page: https://npm.io/package/react-window-size-hook

## Recent versions

- 1.0.3 (latest) — 2020-04-13
- 1.0.2 — 2020-04-05
- 1.0.1 — 2020-04-05
- 1.0.0 — 2020-04-05

## README

# React Window Size Hook

A React hook that re-renders a component when the browser window is resized.

## Usage

```
import React from 'react';
import { useWindowSize } from 'react-window-size-hook';

function MyComponent() {
  const [width, height] = useWindowSize();

  return (
    <div>
      Window width is {width}px and height is {height}px
    </div>
  )
}
```

It's pretty straightforward - it takes no arguments and returns an array containing the dimensions of the window. Bam. Done.

## Live testing

The root of this project has been created using `create-react-app`, and it's an app that simply displays the window dimensions. To run it:

```
npm start
```

## Unit Testing
```
npm test
```

## Who did this?
Carlos Zanella. I'll update this with a link to my online portfolio as soon as it's done (don't hold your breath).

## License
MIT

---
_Source: https://npm.io/package/react-window-size-hook · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
