Skip to content

Latest commit

 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-layout-effect

Tiny package dedicated to an isomorphic useLayoutEffect.

More info: reduxjs/react-redux#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.

About

useLayoutEffect with SSR fallback and React Native support

Topics

Resources

Stars

12 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages