UNPKG

@yookue/react-condition

Version:

Render components conditionally for react

18 lines 517 B
import React from 'react'; import { jsx as _jsx } from "react/jsx-runtime"; export var Do = function Do(props) { var result = []; var index = 0; do { 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-do", children: props.children }, index)); } index++; } while (props.condition()); return result; };