Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-layout-effect

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-layout-effect

Tiny package dedicated to an isomorphic `useLayoutEffect`.

  • 1.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
20K
increased by39.95%
Maintainers
1
Weekly downloads
 
Created
Source

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.

FAQs

Package last updated on 05 May 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc