Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F100872574
useIsomorphicEffect.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Feb 3, 12:01
Size
543 B
Mime Type
text/x-java
Expires
Wed, Feb 5, 12:01 (2 d)
Engine
blob
Format
Raw Data
Handle
24041685
Attached To
rOACCT Open Access Compliance Check Tool (OACCT)
useIsomorphicEffect.js
View Options
import { useEffect, useLayoutEffect } from 'react';
var isReactNative = typeof global !== 'undefined' && // @ts-ignore
global.navigator && // @ts-ignore
global.navigator.product === 'ReactNative';
var isDOM = typeof document !== 'undefined';
/**
* Is `useLayoutEffect` in a DOM or React Native environment, otherwise resolves to useEffect
* Only useful to avoid the console warning.
*
* PREFER `useEffect` UNLESS YOU KNOW WHAT YOU ARE DOING.
*
* @category effects
*/
export default isDOM || isReactNative ? useLayoutEffect : useEffect;
Event Timeline
Log In to Comment