useRefWithInitialValueFactory
API
import useRefWithInitialValueFactory from '@restart/hooks/useRefWithInitialValueFactory'useRefWithInitialValueFactory<T>(initialValueFactory: () => T) => MutableRefObject<T>Exactly the same as
useRefexcept that the initial value is set via a factroy function. Useful when the default is relatively costly to construct.const ref = useRefWithInitialValueFactory<ExpensiveValue>(() => constructExpensiveValue())Parameters
initialValueFactory() => TA factory function returning the ref's default value
Return Value MutableRefObject<T>