UNPKG

1.18 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 }
15
16 if (props && defaultProps) {
17 for (var propName in defaultProps) {
18 if (props[propName] === void 0) {
19 props[propName] = defaultProps[propName];
20 }
21 }
22 } else if (!props) {
23 props = defaultProps || {};
24 }
25
26 if (childrenLength === 1) {
27 props.children = children;
28 } else if (childrenLength > 1) {
29 var childArray = new Array(childrenLength);
30
31 for (var i = 0; i < childrenLength; i++) {
32 childArray[i] = arguments[i + 3];
33 }
34
35 props.children = childArray;
36 }
37
38 return {
39 $$typeof: REACT_ELEMENT_TYPE,
40 type: type,
41 key: key === undefined ? null : '' + key,
42 ref: null,
43 props: props,
44 _owner: null
45 };
46}
\No newline at end of file