React.Suspense
Suspense 是用来做什么的?
const A = React.lazy(() => import('./A'))
return (
<Suspense fallback={<p>loading</p>}>
<Route component={A} path="/a">
</Suspense>
)
更新
最后更新于
const A = React.lazy(() => import('./A'))
return (
<Suspense fallback={<p>loading</p>}>
<Route component={A} path="/a">
</Suspense>
)
最后更新于
export type SuspenseState = {|
alreadyCaptured: boolean,
didTimeout: boolean,
timedOutAt: ExpirationTime,
|};if (finishedWork.effectTag & Callback) {
const newState: SuspenseState = {
alreadyCaptured: true,
didTimeout: false,
timedOutAt: NoWork,
};
finishedWork.memoizedState = newState;
scheduleWork(finishedWork, Sync);
return;
}