Skip to content
Go back

react fiber与diff过程

Fiber 可视为虚拟的堆栈帧,单个fiber就是最小的任务单元。

fiber节点的属性

链表与数组对比

为何要使用链表遍历 Fiber 树?

参考这篇文章。 用链表可以暂停组件的更新工作,并且在后续的某个时间段内恢复它。 React 会一直通过这种方式来遍历, 直到处理完所有的组件并且调用栈为空。

If you rely only on the [built-in] call stack, it will keep doing work until the stack is empty…Wouldn’t it be great if we could interrupt the call stack at will and manipulate stack frames manually? That’s the purpose of React Fiber.Fiber is re-implementation of the stack, specialized for React components. You can think of a single fiber as a virtual stack frame.

diff过程

自己用processon 画的

react fiber与diff过程


Share this post on:

Previous Post
SCSS的常规使用
Next Post
commander.js使用