@react-hook/passive-layout-effect
TypeScript icon, indicating that this package has built-in type declarations

1.2.1 • Public • Published

usePassiveLayoutEffect()

Bundlephobia Types Build status NPM Version MIT License

npm i @react-hook/passive-layout-effect

A React hook that uses useEffect() on the server and useLayoutEffect() in the browser

Quick Start

import useLayoutEffect from '@react-hook/passive-layout-effect'

const Component = ({foo, bar}) => {
  // Used the same way useEffect() and useLayoutEffect() are
  useLayoutEffect(() => {}, [foo, bar])
}

Full credit to

Dan Abramov

LICENSE

MIT

Dependents (21)

Package Sidebar

Install

npm i @react-hook/passive-layout-effect

Weekly Downloads

389,693

Version

1.2.1

License

MIT

Unpacked Size

11.2 kB

Total Files

25

Last publish

Collaborators

  • jaredlunde