UNPKG

@yookue/react-condition

Version:

Render components conditionally for react

15 lines 563 B
import React from 'react'; import { jsx as _jsx } from "react/jsx-runtime"; export var MapIterator = function MapIterator(props) { return Array.from(props.of).map(function (item, index) { if (props.render) { return (item === null || item === void 0 ? void 0 : item.length) > 1 ? props.render(item[1], item[0], index) : undefined; } else if (!props.render && props.children) { return /*#__PURE__*/_jsx("div", { className: "condition-map-iterator", children: props.children }, index); } return undefined; }); };