UNPKG

zangai-react

Version:
9 lines (8 loc) 364 B
import * as tslib_1 from "tslib"; import * as React from 'react'; export var ChildrenWithProp = function (children, props) { return children ? React.Children.map(children, function (child, index) { if (typeof children.type === 'string') { props = {}; } return React.cloneElement(child, tslib_1.__assign({ index: index }, props)); }) : null; };