one
Version:
One is a React framework for web, iOS, and Android apps.
16 lines (13 loc) • 322 B
JavaScript
import * as React from "react";
function useConstant(fn) {
if (typeof document === "undefined") {
return React.useMemo(() => fn(), []);
}
const ref = React.useRef(void 0);
if (!ref.current) {
ref.current = { v: fn() };
}
return ref.current.v;
}
export { useConstant };
//# sourceMappingURL=useConstant.mjs.map