mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-23 00:45:16 +00:00
15 lines
543 B
TypeScript
15 lines
543 B
TypeScript
|
/// <reference types="react" />
|
||
|
/**
|
||
|
* Exactly the same as `useRef` except that the initial value is set via a
|
||
|
* factroy function. Useful when the default is relatively costly to construct.
|
||
|
*
|
||
|
* ```ts
|
||
|
* const ref = useRefWithInitialValueFactory<ExpensiveValue>(() => constructExpensiveValue())
|
||
|
*
|
||
|
* ```
|
||
|
*
|
||
|
* @param initialValueFactory A factory function returning the ref's default value
|
||
|
* @category refs
|
||
|
*/
|
||
|
export default function useRefWithInitialValueFactory<T>(initialValueFactory: () => T): import("react").MutableRefObject<T>;
|