JSPM

@react-hook/passive-layout-effect

1.2.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 764852
  • Score
    100M100P100Q207744F
  • License MIT

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

Package Exports

  • @react-hook/passive-layout-effect
  • @react-hook/passive-layout-effect/package.json

Readme


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