one
Version:
One is a new React Framework that makes Vite serve both native and web.
13 lines (12 loc) • 331 B
JavaScript
import * as React from "react";
function useConstant(fn) {
if (typeof document > "u") return React.useMemo(function () {
return fn();
}, []);
var ref = React.useRef(void 0);
return ref.current || (ref.current = {
v: fn()
}), ref.current.v;
}
export { useConstant };
//# sourceMappingURL=useConstant.native.js.map