GoScrobble/web/node_modules/@restart/hooks/cjs/useStableMemo.d.ts

11 lines
480 B
TypeScript
Raw Permalink Normal View History

2022-04-25 02:47:15 +00:00
import { DependencyList } from 'react';
/**
* Identical to `useMemo` _except_ that it provides a semantic guarantee that
* values will not be invalidated unless the dependencies change. This is unlike
* the built in `useMemo` which may discard memoized values for performance reasons.
*
* @param factory A function that returns a value to be memoized
* @param deps A dependency array
*/
export default function useStableMemo<T>(factory: () => T, deps?: DependencyList): T;