(init: () => T)
| 13 | * @param init - A function to generate the value |
| 14 | */ |
| 15 | export default function useConstant<T>(init: () => T): T { |
| 16 | const ref = React.useRef<T | undefined>(undefined); |
| 17 | if (!ref.current) { |
| 18 | ref.current = init(); |
| 19 | } |
| 20 | return ref.current; |
| 21 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…