Download react-spring/packages/shared/src/hooks/useIsomorphicLayoutEffect.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 423 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-spring/packages/shared/src/hooks/useIsomorphicLayoutEffect.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-spring/packages/shared/src/hooks/useIsomorphicLayoutEffect.ts
-
curl -L -o useIsomorphicLayoutEffect.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-spring/packages/shared/src/hooks/useIsomorphicLayoutEffect.ts
423 Bytes
| import { useEffect, useLayoutEffect } from 'react' | |
| import { isSSR } from '../helpers' | |
| /** | |
| * Use this to read layout from the DOM and synchronously | |
| * re-render if the isSSR returns true. Updates scheduled | |
| * inside `useIsomorphicLayoutEffect` will be flushed | |
| * synchronously in the browser, before the browser has | |
| * a chance to paint. | |
| */ | |
| export const useIsomorphicLayoutEffect = isSSR() ? useEffect : useLayoutEffect | |