I would like to ask the diff algorithm in react is the depth-first traversal or breadth-first traversal of the tree?

is the diff algorithm in react a depth-first traversal or a breadth-first traversal of the tree? Or is it some other way of traversing?

Apr.07,2021

depth first . I wrote a simple React implementation here.

https://github.com/azl3979858.


breadth. If a change is detected in a node, the node and all its descendant nodes are updated to improve performance.

Menu