Comments (7)
这里实际上是在讨论completeWork
函数的返回值, 绝大多数情况都返回的null
(即不会派生出子节点). 只有一种特殊情况涉及到SuspenseComponent 和 SuspenseListComponent
组件, 它们是有返回值的. @creamidea 已经贴上了对应的源码.
在v17.0.2
中, 这些组件虽然在源码中体现了, 实际上是用不上的. 这个是v18
的feature, 需要安装v18
对应的版本才能体验.
SuspenseComponent
有下级fallback组件
需要渲染, 所以completeWork
函数会返回自身, 最后退出completeUnitOfWork
, 再次进入beginWork
阶段去生成fallback组件
对应的fiber节点
from react-illustration-series.
completeUnitOfWork 阶段会有VDOM 的拼接操作
这个能帮忙具体定位一下代码吗?我在 completeUnitOfWork 里面没有找到。谢谢
@jacty 指的vdom拼接是否就是指代的SuspenseComponent
的fallback
这种形式?
from react-illustration-series.
看源码,有以下几种情况
SuspenseComponent & DidCapture
SuspenseListComponent
from react-illustration-series.
谢谢大佬解答
from react-illustration-series.
深度优先:先找当前节点下是否有子节点,没有的话则查找当前节点的兄弟节点,再没有则返回父节点进行同样类型的查找。
completeUnitOfWork 阶段会有VDOM 的拼接操作,这个拼接会导致当前节点存在新增节点的情况,则需要去查找该新增节点上的一些信息,比如是否还有更深的子节点以及新增节点的属性等。
from react-illustration-series.
completeUnitOfWork 阶段会有VDOM 的拼接操作
这个能帮忙具体定位一下代码吗?我在 completeUnitOfWork 里面没有找到。谢谢
from react-illustration-series.
确实,通过源码看出来,目前 Suspense 会出现新增 fiber 节点的操作。感谢大佬们 🙏
from react-illustration-series.
Related Issues (20)
- 原理解析的一些误点? HOT 1
- fiber树构造阶段的问题
- fiber树构造(对比更新) -> 过程图解 -> performUnitOfWork第 4 次调用(执行beginWork和completeUnitOfWork)
- 移动端页面有问题,无法导航 HOT 2
- 网站好像挂了 HOT 2
- 网站中“运行核心”部分章节顺序错乱
- 网站的标题定位有点问题
- 链表操作的图是不是画错了 HOT 1
- document.getElementById 大小写错误
- 同学,18有计划吗 HOT 3
- 请问博客的生成框架用的是哪一个 HOT 2
- 请问下博主,是不是现在的16,17其实都是同步循环 HOT 3
- 啥时候更新React18呢
- fiber 优先级 HOT 1
- 图画错了 HOT 1
- commitBeforeMutationEffects 里处理的是哪些 Hook ? HOT 1
- mime模块拒绝服务漏洞 - [email protected] - 间接引入 HOT 2
- Can we port this to English in a fork HOT 6
- effect hooks图例的构造顺序是否有问题 HOT 2
- 反转链表代码有误 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-illustration-series.