jsx.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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" && Symbol["for"] && Symbol["for"]("react.element") || 0xeac7;
  10. }
  11. var defaultProps = type && type.defaultProps;
  12. var childrenLength = arguments.length - 3;
  13. if (!props && childrenLength !== 0) {
  14. props = {
  15. children: void 0
  16. };
  17. }
  18. if (childrenLength === 1) {
  19. props.children = children;
  20. } else if (childrenLength > 1) {
  21. var childArray = new Array(childrenLength);
  22. for (var i = 0; i < childrenLength; i++) {
  23. childArray[i] = arguments[i + 3];
  24. }
  25. props.children = childArray;
  26. }
  27. if (props && defaultProps) {
  28. for (var propName in defaultProps) {
  29. if (props[propName] === void 0) {
  30. props[propName] = defaultProps[propName];
  31. }
  32. }
  33. } else if (!props) {
  34. props = defaultProps || {};
  35. }
  36. return {
  37. $$typeof: REACT_ELEMENT_TYPE,
  38. type: type,
  39. key: key === undefined ? null : "" + key,
  40. ref: null,
  41. props: props,
  42. _owner: null
  43. };
  44. }
  45. //# sourceMappingURL=jsx.js.map