UNPKG

543 BTypeScriptView Raw
1/// <reference types="react" />
2/**
3 * Exactly the same as `useRef` except that the initial value is set via a
4 * factroy function. Useful when the default is relatively costly to construct.
5 *
6 * ```ts
7 * const ref = useRefWithInitialValueFactory<ExpensiveValue>(() => constructExpensiveValue())
8 *
9 * ```
10 *
11 * @param initialValueFactory A factory function returning the ref's default value
12 * @category refs
13 */
14export default function useRefWithInitialValueFactory<T>(initialValueFactory: () => T): import("react").MutableRefObject<T>;