one
Version:
One is a React framework for web, iOS, and Android apps.
25 lines (22 loc) • 610 B
JavaScript
import React from "react";
const Decorated = /* @__PURE__ */ Symbol();
const withStaticProperties = (component, staticProps) => {
const next = (() => {
if (component[Decorated]) {
const _ = React.forwardRef((props, ref) => React.createElement(component, {
...props,
ref
}));
for (const key in component) {
const v = component[key];
_[key] = v && typeof v === "object" ? { ...v } : v;
}
}
return component;
})();
Object.assign(next, staticProps);
next[Decorated] = true;
return next;
};
export { withStaticProperties };
//# sourceMappingURL=withStaticProperties.mjs.map