one
Version:
One is a new React Framework that makes Vite serve both native and web.
18 lines (17 loc) • 372 B
JavaScript
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