UNPKG

antd

Version:

An enterprise-class UI design language and React components implementation

13 lines 523 B
import React from 'react'; export function isFragment(child) { return child && /*#__PURE__*/React.isValidElement(child) && child.type === React.Fragment; } export const replaceElement = (element, replacement, props) => { if (! /*#__PURE__*/React.isValidElement(element)) { return replacement; } return /*#__PURE__*/React.cloneElement(element, typeof props === 'function' ? props(element.props || {}) : props); }; export function cloneElement(element, props) { return replaceElement(element, element, props); }