# react-layout-effect

> Tiny package dedicated to an isomorphic `useLayoutEffect`.

Latest version **1.0.5** (published 2020-05-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-layout-effect
pnpm add react-layout-effect
yarn add react-layout-effect
bun add react-layout-effect
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2020-05-05 |
| First published | 2019-11-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 12 |
| Author | Alec Larson |
| Maintainers | aleclarson |

## Links

- npm: https://www.npmjs.com/package/react-layout-effect
- Repository: https://github.com/alloc/react-layout-effect
- Homepage: https://github.com/alloc/react-layout-effect#readme
- Issues: https://github.com/alloc/react-layout-effect/issues
- npm.io page: https://npm.io/package/react-layout-effect

## Recent versions

- 1.0.5 (latest) — 2020-05-05
- 1.0.4 — 2020-05-05
- 1.0.3 — 2019-11-12
- 1.0.2 — 2019-11-12
- 1.0.1 — 2019-11-10
- 1.0.0 — 2019-11-10

## README

# react-layout-effect

Tiny package dedicated to an isomorphic `useLayoutEffect`.

More info: https://github.com/reduxjs/react-redux/pull/1444

## Usage

```ts
import { useLayoutEffect } from 'react-layout-effect'

const MyComponent = () => {
  useLayoutEffect(() => {
    console.log('hi')
  })
}
```

The "hi" message is only logged when 1+ of these is true:
  - `window.document.createElement` exists
  - using a bundler that supports ".native.js" overrides

The warning message [thrown by React](https://github.com/facebook/react/issues/14927) is avoided in SSR environments.

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