UNPKG

1.2 kBJavaScriptView Raw
1import _Symbol$for from "../../core-js/symbol/for";
2import _Symbol from "../../core-js/symbol";
3var REACT_ELEMENT_TYPE;
4export default function _createRawReactElement(type, props, key, children) {
5 if (!REACT_ELEMENT_TYPE) {
6 REACT_ELEMENT_TYPE = typeof _Symbol === "function" && _Symbol$for && _Symbol$for("react.element") || 0xeac7;
7 }
8
9 var defaultProps = type && type.defaultProps;
10 var childrenLength = arguments.length - 3;
11
12 if (!props && childrenLength !== 0) {
13 props = {
14 children: void 0
15 };
16 }
17
18 if (props && defaultProps) {
19 for (var propName in defaultProps) {
20 if (props[propName] === void 0) {
21 props[propName] = defaultProps[propName];
22 }
23 }
24 } else if (!props) {
25 props = defaultProps || {};
26 }
27
28 if (childrenLength === 1) {
29 props.children = children;
30 } else if (childrenLength > 1) {
31 var childArray = new Array(childrenLength);
32
33 for (var i = 0; i < childrenLength; i++) {
34 childArray[i] = arguments[i + 3];
35 }
36
37 props.children = childArray;
38 }
39
40 return {
41 $$typeof: REACT_ELEMENT_TYPE,
42 type: type,
43 key: key === undefined ? null : '' + key,
44 ref: null,
45 props: props,
46 _owner: null
47 };
48}
\No newline at end of file