UNPKG

@modern-kit/react

Version:
18 lines (15 loc) 480 B
import { jsx, Fragment } from 'react/jsx-runtime'; const getConditionResult = (condition) => { return typeof condition === "function" ? condition() : condition; }; const When = ({ children, condition, fallback }) => { const conditionResult = getConditionResult(condition); if (!conditionResult) return /* @__PURE__ */ jsx(Fragment, { children: fallback }); return /* @__PURE__ */ jsx(Fragment, { children }); }; export { When }; //# sourceMappingURL=index.mjs.map