# react-resize-listener

> Resize listener for React apps

Latest version **0.3.6** (published 2017-10-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-resize-listener
pnpm add react-resize-listener
yarn add react-resize-listener
bun add react-resize-listener
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.6 |
| Published | 2017-10-22 |
| First published | 2017-10-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Kevin Kipp |
| Maintainers | third774 |
| Keywords | react, resize, listener |

## Links

- npm: https://www.npmjs.com/package/react-resize-listener
- Repository: https://github.com/third774/react-resize-listener
- Issues: https://github.com/third774/react-resize-listener/issues
- npm.io page: https://npm.io/package/react-resize-listener

## 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

- 0.3.6 (latest) — 2017-10-22
- 0.3.5 — 2017-10-22
- 0.3.4 — 2017-10-20
- 0.3.3 — 2017-10-20
- 0.3.2 — 2017-10-20
- 0.3.1 — 2017-10-20
- 0.3.0 — 2017-10-20

## README

# React Resize Listener

## Demo

[Check out the demo.](https://stackblitz.com/edit/react-nrlzrm)

## Installation

`npm i react-resize-listener`

## Usage

This component uses an `<iframe />` component under the hood that is positioned absolutely to fill a container to listen for resize events on its `contentWindow`.

Be sure to set `position: relative;` on the parent container that you want to listen on, and be aware of any other positioned containers that might be in between.

## Debug mode

You can add `debug` to the `ResizeListener` component to show an outline around the resize listener container, and it will automatically `console.log()` every time the `onResize` event fires. This can be useful if you aren't sure whether the listener is filling the container you think it is.

## Example

```jsx

import React, {Component} from "react";
import {ResizeListener} from "react-resize-listener";

const ResizableComponent = (props) => (
  <div className="might-resize" style={{position: "relative"}}>
    <p>
      This container might resize for whatever reason, and
      we might want to know when it does and the dimensions
      when it does
    </p>
    <ResizeListener debug onResize={props.doSomething} />
  </div>
)

```

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