MCPcopy Index your code
hub / github.com/reactjs/react-rails / lazy

Function lazy

lib/assets/react-source/development/react.js:1758–1806  ·  view source on GitHub ↗
(ctor)

Source from the content-addressed store, hash-verified

1756 }
1757
1758 function lazy(ctor) {
1759 var lazyType = {
1760 $$typeof: REACT_LAZY_TYPE,
1761 _ctor: ctor,
1762 // React uses these fields to store the result.
1763 _status: -1,
1764 _result: null
1765 };
1766
1767 {
1768 // In production, this would just set it on the object.
1769 var defaultProps;
1770 var propTypes;
1771 Object.defineProperties(lazyType, {
1772 defaultProps: {
1773 configurable: true,
1774 get: function () {
1775 return defaultProps;
1776 },
1777 set: function (newDefaultProps) {
1778 error('React.lazy(...): It is not supported to assign `defaultProps` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
1779
1780 defaultProps = newDefaultProps; // Match production behavior more closely:
1781
1782 Object.defineProperty(lazyType, 'defaultProps', {
1783 enumerable: true
1784 });
1785 }
1786 },
1787 propTypes: {
1788 configurable: true,
1789 get: function () {
1790 return propTypes;
1791 },
1792 set: function (newPropTypes) {
1793 error('React.lazy(...): It is not supported to assign `propTypes` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
1794
1795 propTypes = newPropTypes; // Match production behavior more closely:
1796
1797 Object.defineProperty(lazyType, 'propTypes', {
1798 enumerable: true
1799 });
1800 }
1801 }
1802 });
1803 }
1804
1805 return lazyType;
1806 }
1807
1808 function forwardRef(render) {
1809 {

Callers

nothing calls this directly

Calls 1

errorFunction · 0.70

Tested by

no test coverage detected