1.0.3 • Published 5 years ago

uselazyref v1.0.3

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

useLazyRef

A wrapper to React's own useRef to support lazy initialization. So far, lazy init is supported by useState, but not useRef. Once React updates useRef, this package becomes deprecated.

Caution: it does not support non-lazy initialization. In this case, you should use the standard useRef instead.

Usage

const ref = useLazyRef(() => expensiveComputation());