react-layout-effect
Last updated 7 years ago by aleclarson .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install react-layout-effect 
SYNC missed versions from official npm registry.

react-layout-effect

Tiny package dedicated to an isomorphic useLayoutEffect.

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

Usage

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 is avoided in SSR environments.

Current Tags

  • 1.0.5                                ...           latest (7 years ago)

6 Versions

  • 1.0.5                                ...           7 years ago
  • 1.0.4                                ...           7 years ago
  • 1.0.3                                ...           7 years ago
  • 1.0.2                                ...           7 years ago
  • 1.0.1                                ...           7 years ago
  • 1.0.0                                ...           7 years ago
Maintainers (1)
Downloads
Total 19
Today 0
This Week 4
This Month 10
Last Day 0
Last Week 5
Last Month 8
Dependencies (0)
None
Dev Dependencies (4)

© 2010 - cnpmjs.org x YWFE | Home | YWFE