7kms/react-illustration-series

subtreeFlags是怎么代替firstEffect, nextEffect的?

Empire-T9 opened this issue · 1 comments

最新版react代码,用subtreeFlags是代替firstEffect, nextEffect,这部分不是双链表了吗?

是的,目前了解到这种是为了新的 Suspense 特性做的改造,在 commit 阶段需要再次遍历整树。能够让下面的例子中 Component 在 loading 的时候也能过显示出来

<Suspense fallback="loading...">
  // LazyComponent 需要请求远程数据才能展示
  <LazyComponent />
 
  // Component 正常组件
  <Component />
</Suspense>