You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
10 lines
433 B
10 lines
433 B
import * as React from 'react';
|
|
var isValidElement = React.isValidElement;
|
|
export { isValidElement };
|
|
export function replaceElement(element, replacement, props) {
|
|
if (!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);
|
|
} |