企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持知识库和私有化部署方案 广告
~~~ 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, ~~~