Download react-spring/docs/app/hooks/useIsomorphicEffect.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 408 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-spring/docs/app/hooks/useIsomorphicEffect.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-spring/docs/app/hooks/useIsomorphicEffect.ts
-
curl -L -o useIsomorphicEffect.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-spring/docs/app/hooks/useIsomorphicEffect.ts
408 Bytes
| import { useEffect, useLayoutEffect } from 'react' | |
| // For server-side rendering: https://github.com/react-spring/zustand/pull/34 | |
| // Deno support: https://github.com/pmndrs/zustand/issues/347 | |
| const isSSR = | |
| typeof window === 'undefined' || | |
| !window.navigator || | |
| /ServerSideRendering|^Deno\//.test(window.navigator.userAgent) | |
| export const useIsomorphicLayoutEffect = isSSR ? useEffect : useLayoutEffect | |