UNPKG

1.11 kBJavaScriptView Raw
1var REACT_ELEMENT_TYPE;
2export default function _createRawReactElement(type, props, key, children) {
3 if (!REACT_ELEMENT_TYPE) {
4 REACT_ELEMENT_TYPE = typeof Symbol === "function" && Symbol["for"] && Symbol["for"]("react.element") || 0xeac7;
5 }
6
7 var defaultProps = type && type.defaultProps;
8 var childrenLength = arguments.length - 3;
9
10 if (!props && childrenLength !== 0) {
11 props = {
12 children: void 0
13 };
14 }
15
16 if (childrenLength === 1) {
17 props.children = children;
18 } else if (childrenLength > 1) {
19 var childArray = new Array(childrenLength);
20
21 for (var i = 0; i < childrenLength; i++) {
22 childArray[i] = arguments[i + 3];
23 }
24
25 props.children = childArray;
26 }
27
28 if (props && defaultProps) {
29 for (var propName in defaultProps) {
30 if (props[propName] === void 0) {
31 props[propName] = defaultProps[propName];
32 }
33 }
34 } else if (!props) {
35 props = defaultProps || {};
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