Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 7138x 157x 6981x | import * as React from 'react';
import { isFunction } from './isFunction';
type Props = {
children?: React.ReactNode;
component: string | React.ComponentType<any>;
enableRenderPropsComposition?: boolean;
use?: string | React.ComponentType<any>;
htmlProps: any;
};
export function createElement({ children, component, enableRenderPropsComposition = true, htmlProps, use }: Props) {
if (enableRenderPropsComposition && isFunction(children)) {
return children(htmlProps);
}
return React.createElement(component, { as: use, ...htmlProps }, htmlProps.children || children);
}
|