# @actualwave/use-element-size

> React hook that watches for updates and returns element size.

Latest version **0.0.1** (published 2021-11-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install @actualwave/use-element-size
pnpm add @actualwave/use-element-size
yarn add @actualwave/use-element-size
bun add @actualwave/use-element-size
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2021-11-01 |
| First published | 2021-11-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Oleg Galaburda |
| Maintainers | actualwave |
| Keywords | react, element, size, resize, event, hook |

## Links

- npm: https://www.npmjs.com/package/@actualwave/use-element-size
- Homepage: https://gist.github.com/burdiuz/9d88b6960552bea7ce5070c0d9549f77
- Issues: https://gist.github.com/burdiuz/9d88b6960552bea7ce5070c0d9549f77
- npm.io page: https://npm.io/package/@actualwave/use-element-size

## Alternatives

- [async-exit-hook](https://npm.io/package/async-exit-hook.md) — 3.7M weekly downloads
- [evnty](https://npm.io/package/evnty.md) — 7.2K weekly downloads
- [eleventy-plugin-asciidoc](https://npm.io/package/eleventy-plugin-asciidoc.md) — 3.5K weekly downloads
- [@jswork/next-get2get](https://npm.io/package/@jswork/next-get2get.md) — 945 weekly downloads
- [@dashersw/axon](https://npm.io/package/@dashersw/axon.md) — 934 weekly downloads

## Recent versions

- 0.0.1 (latest) — 2021-11-01

## README

# @actualwave/use-element-size
React hook that watches for changes in element size using ResizeObserver and reports updates forcing component to render.
There are two hooks in this package
 * **useResizeObserver**(handlerFn, elementRef) -- Calls `handlerFn()` when element size changed with instance of [DOMRectReadOnly](https://developer.mozilla.org/en-US/docs/Web/API/DOMRectReadOnly).
 * **useElementSize**(elementRef, reinitInEffect = true) -- Returns element size or null if `elementRef.current` does not contain reference to HTMLElement. `reinitInEffect` forces immediate re-render to apply element sizes, expected to have a valid reference at the time of re-render.

Example on [codesandbox.io](https://codesandbox.io/s/react-use-element-size-hook-htq59).

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