多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
~~~ import {lazy} from './ReactLazy'; ~~~ **文件路径** ``` packages/react/src/ReactLazy.js ``` ~~~ export function lazy<T, R>(ctor: () => Thenable<T, R>): LazyComponent<T> { let lazyType = { $$typeof: REACT_LAZY_TYPE, _ctor: ctor, // React uses these fields to store the result. _status: -1, //记录Thenable处于什么状态 _result: null, }; return lazyType; } ~~~ Suspense是type ~~~ Suspense: REACT_SUSPENSE_TYPE, ~~~