UNPKG

@whop/react

Version:

React SDK for building embedded apps on Whop

20 lines (19 loc) 423 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "useLazyRef", { enumerable: true, get: function() { return useLazyRef; } }); const _react = require("react"); const none = Symbol("none"); function useLazyRef(fn) { const ref = (0, _react.useRef)(none); if (ref.current === none) { ref.current = fn(); } return ref; }