Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React核心回顾 - 折口木木 #16

Open
ZhelinCheng opened this issue Mar 27, 2023 · 0 comments
Open

React核心回顾 - 折口木木 #16

ZhelinCheng opened this issue Mar 27, 2023 · 0 comments

Comments

@ZhelinCheng
Copy link
Owner

https://zhelin.me/92c2857df42fa342/

React Fiber理念

  1. 为什么ES语法中有Generator可以实现异步、中断、恢复的功能,React团队还要重新设计呢?

Fiber Principles: Contributing To Fiber #7942

  • 类似async,Generator也是传染性的,使用了Generator则上下文的其他函数也需要作出改变。这样心智负担比较重;
  • Generator执行的中间状态是上下文关联的;

同时,Generator虽然可以实现异步、中断、恢复,但无法调度更新的优先级。

  1. Fiber架构的实现原理?

React Fiber Architecture

2.1 Fiber含义

2.1.1 架构

react15(Stack Reconciler):Reconciler采用递归的方式执行,数据保存在递归的调用栈中。

react16(Fiber Reconciler):基于Fiber节点实现的。

2.1.2 作为静态数据结构(虚拟DOM)

每个Fiber节点对应一个React

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant