# react-use-window-size

> Custom React Hook to get width of the browser window

Latest version **1.0.1** (published 2019-05-05) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2019-05-05 |
| First published | 2019-05-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 2.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | danielkhoo |
| Keywords | React, Hooks, Custom Hooks, Window Size, Window Width, Window Height |

## Links

- npm: https://www.npmjs.com/package/react-use-window-size
- Repository: https://github.com/danielkhoo/react-use-window-size
- Issues: https://github.com/danielkhoo/react-use-window-size/issues
- npm.io page: https://npm.io/package/react-use-window-size

## Dependencies (1)

- [react](https://npm.io/package/react.md) ^16.8.6

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2019-05-05
- 1.0.0 — 2019-05-01
- 0.0.1 — 2019-05-01

## README

# useWindowSize - Custom React Hook

[![](https://img.shields.io/npm/v/react-use-window-size.svg?style=flat)](https://github.com/danielkhoo/react-use-window-size)
[![](https://img.shields.io/bundlephobia/min/react-use-window-size.svg?style=flat)](https://github.com/danielkhoo/react-use-window-size)

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

```js
import useWindowSize from './useWindowSize';

const { width, height } = useWindowSize();

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

## License

MIT

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