@yookue/react-condition
Version:
Render components conditionally for react
18 lines • 522 B
JavaScript
import React from 'react';
import { jsx as _jsx } from "react/jsx-runtime";
export var While = function While(props) {
var result = [];
var index = 0;
while (props.condition()) {
if (props.render) {
result.push(props === null || props === void 0 ? void 0 : props.render(index));
} else if (!props.render && props.children) {
result.push( /*#__PURE__*/_jsx("div", {
className: "condition-while",
children: props.children
}, index));
}
index++;
}
return result;
};