_jsx.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = _createRawReactElement;
  6. function _createRawReactElement(type, props, key, children) {
  7. if (!REACT_ELEMENT_TYPE) {
  8. REACT_ELEMENT_TYPE = typeof Symbol === "function" && Symbol.for && Symbol.for("react.element") || 0xeac7;
  9. }
  10. var defaultProps = type && type.defaultProps;
  11. var childrenLength = arguments.length - 3;
  12. if (!props && childrenLength !== 0) {
  13. props = {
  14. children: void 0
  15. };
  16. }
  17. if (props && defaultProps) {
  18. for(var propName in defaultProps){
  19. if (props[propName] === void 0) {
  20. props[propName] = defaultProps[propName];
  21. }
  22. }
  23. } else if (!props) {
  24. props = defaultProps || {};
  25. }
  26. if (childrenLength === 1) {
  27. props.children = children;
  28. } else if (childrenLength > 1) {
  29. var childArray = new Array(childrenLength);
  30. for(var i = 0; i < childrenLength; i++){
  31. childArray[i] = arguments[i + 3];
  32. }
  33. props.children = childArray;
  34. }
  35. return {
  36. $$typeof: REACT_ELEMENT_TYPE,
  37. type: type,
  38. key: key === undefined ? null : '' + key,
  39. ref: null,
  40. props: props,
  41. _owner: null
  42. };
  43. }
  44. var REACT_ELEMENT_TYPE;