UNPKG

react-intlayer

Version:

Easily internationalize i18n your React applications with type-safe multilingual content management.

16 lines (14 loc) 633 B
import { isValidElement } from "react"; import { Fragment, jsx } from "react/jsx-runtime"; //#region src/IntlayerNode.tsx const renderIntlayerNode = ({ children, value, additionalProps }) => { const element = isValidElement(children) ? children : /* @__PURE__ */ jsx(Fragment, { children }); return new Proxy(element, { get(target, prop, receiver) { if (prop === "value") return value; if (additionalProps && Object.keys(additionalProps).includes(prop)) return additionalProps[prop]; return Reflect.get(target, prop, receiver); } }); }; //#endregion export { renderIntlayerNode }; //# sourceMappingURL=IntlayerNode.mjs.map