UNPKG

one

Version:

One is a React framework for web, iOS, and Android apps.

18 lines (15 loc) • 348 B
import * as React from "react"; function useConstant(fn) { if (typeof document === "undefined") { return React.useMemo(function() { return fn(); }, []); } var ref = React.useRef(void 0); if (!ref.current) { ref.current = { v: fn() }; } return ref.current.v; } export { useConstant }; //# sourceMappingURL=useConstant.native.js.map