@modern-kit/react
Version:
20 lines (16 loc) • 539 B
JavaScript
;
var jsxRuntime = require('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__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: fallback });
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
};
exports.When = When;
//# sourceMappingURL=index.cjs.map