jsx.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. var _Symbol$for = require("../core-js/symbol/for");
  2. var _Symbol = require("../core-js/symbol");
  3. var REACT_ELEMENT_TYPE;
  4. 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. var defaultProps = type && type.defaultProps;
  9. var childrenLength = arguments.length - 3;
  10. if (!props && childrenLength !== 0) {
  11. props = {
  12. children: void 0
  13. };
  14. }
  15. if (props && defaultProps) {
  16. for (var propName in defaultProps) {
  17. if (props[propName] === void 0) {
  18. props[propName] = defaultProps[propName];
  19. }
  20. }
  21. } else if (!props) {
  22. props = defaultProps || {};
  23. }
  24. if (childrenLength === 1) {
  25. props.children = children;
  26. } else if (childrenLength > 1) {
  27. var childArray = new Array(childrenLength);
  28. for (var i = 0; i < childrenLength; i++) {
  29. childArray[i] = arguments[i + 3];
  30. }
  31. props.children = childArray;
  32. }
  33. return {
  34. $$typeof: REACT_ELEMENT_TYPE,
  35. type: type,
  36. key: key === undefined ? null : '' + key,
  37. ref: null,
  38. props: props,
  39. _owner: null
  40. };
  41. }
  42. module.exports = _createRawReactElement;