Spaces:
Sleeping
Sleeping
Download node_modules/@reduxjs/toolkit/src/query/react/useShallowStableValue.ts from Scribbler310/gs-port: direct link, hf CLI and curl.
- Browser
- Download file 372 Bytes
-
https://huggingface.co/spaces/Scribbler310/gs-port/resolve/main/node_modules/%40reduxjs/toolkit/src/query/react/useShallowStableValue.ts
- Command line
-
hf download hf://spaces/Scribbler310/gs-port/node_modules/@reduxjs/toolkit/src/query/react/useShallowStableValue.ts
-
curl -L -o useShallowStableValue.ts https://huggingface.co/spaces/Scribbler310/gs-port/resolve/main/node_modules/%40reduxjs/toolkit/src/query/react/useShallowStableValue.ts
372 Bytes
| import { useEffect, useRef } from './reactImports' | |
| import { shallowEqual } from './reactReduxImports' | |
| export function useShallowStableValue<T>(value: T) { | |
| const cache = useRef(value) | |
| useEffect(() => { | |
| if (!shallowEqual(cache.current, value)) { | |
| cache.current = value | |
| } | |
| }, [value]) | |
| return shallowEqual(cache.current, value) ? cache.current : value | |
| } | |