(
ctor: () => Thenable<{ default: T }>
)
| 72 | } |
| 73 | |
| 74 | export function lazy<T>( |
| 75 | ctor: () => Thenable<{ default: T }> |
| 76 | ): LazyComponent<T, Payload<T>> { |
| 77 | const payload: Payload<T> = { |
| 78 | _status: Uninitialized, |
| 79 | _result: ctor |
| 80 | }; |
| 81 | |
| 82 | const lazyType: LazyComponent<T, Payload<T>> = { |
| 83 | $$typeof: REACT_LAZY_TYPE, |
| 84 | _payload: payload, |
| 85 | _init: lazyInitializer |
| 86 | }; |
| 87 | |
| 88 | return lazyType; |
| 89 | } |