UNPKG

@preact-hooks/instance

Version:

A custom Preact Hook that provides a sensible alternative to useRef for storing instance variables.

2 lines (1 loc) 166 B
import{useRef as r}from"preact/hooks";export default function(t){void 0===t&&(t={});var n=r(null);return n.current||(n.current="function"==typeof t?t():t),n.current}