Buckets:
| import React from 'react' | |
| /** | |
| * An SSR-friendly useLayoutEffect. | |
| * | |
| * React currently throws a warning when using useLayoutEffect on the server. | |
| * To get around it, we can conditionally useEffect on the server (no-op) and | |
| * useLayoutEffect elsewhere. | |
| * | |
| * @see https://github.com/facebook/react/issues/14927 | |
| */ | |
| export const useIsomorphicLayoutEffect = | |
| typeof window !== 'undefined' && (window.document?.createElement || window.navigator?.product === 'ReactNative') | |
| ? React.useLayoutEffect | |
| : React.useEffect | |
| export function useMutableCallback<T>(fn: T) { | |
| const ref = React.useRef<T>(fn) | |
| useIsomorphicLayoutEffect(() => void (ref.current = fn), [fn]) | |
| return ref | |
| } | |
Xet Storage Details
- Size:
- 686 Bytes
- Xet hash:
- e80a7c2a6e8f00363357117a9165be339cdb248ea36ed63632ec0c2e614cbde2
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.