jsx.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = _createRawReactElement;
  6. var REACT_ELEMENT_TYPE;
  7. function _createRawReactElement(type, props, key, children) {
  8. if (!REACT_ELEMENT_TYPE) {
  9. REACT_ELEMENT_TYPE = typeof Symbol === "function" &&
  10. Symbol["for"] && Symbol["for"]("react.element") || 0xeac7;
  11. }
  12. var defaultProps = type && type.defaultProps;
  13. var childrenLength = arguments.length - 3;
  14. if (!props && childrenLength !== 0) {
  15. props = {
  16. children: void 0
  17. };
  18. }
  19. if (childrenLength === 1) {
  20. props.children = children;
  21. } else if (childrenLength > 1) {
  22. var childArray = new Array(childrenLength);
  23. for (var i = 0; i < childrenLength; i++) {
  24. childArray[i] = arguments[i + 3];
  25. }
  26. props.children = childArray;
  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. return {
  38. $$typeof: REACT_ELEMENT_TYPE,
  39. type: type,
  40. key: key === undefined ? null : "" + key,
  41. ref: null,
  42. props: props,
  43. _owner: null
  44. };
  45. }
  46. //# sourceMappingURL=jsx.js.map