Dashboard sipadu mbip
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

useIsomorphicEffect.js 519B

12345678910111213
  1. import { useEffect, useLayoutEffect } from 'react';
  2. var isReactNative = typeof global !== 'undefined' && // @ts-ignore
  3. global.navigator && // @ts-ignore
  4. global.navigator.product === 'ReactNative';
  5. var isDOM = typeof document !== 'undefined';
  6. /**
  7. * Is `useLayoutEffect` in a DOM or React Native environment, otherwise resolves to useEffect
  8. * Only useful to avoid the console warning.
  9. *
  10. * PREFER `useEffect` UNLESS YOU KNOW WHAT YOU ARE DOING.
  11. */
  12. export default isDOM || isReactNative ? useLayoutEffect : useEffect;