diffing algorithm

The rules React uses to compare an old element tree with a new one and find what changed.

In more detail

A general algorithm for comparing two trees takes cubic time in the number of nodes. React instead assumes that elements of different types produce different trees and that keys mark the same child across renders, which brings the cost down to linear time.

Related terms

Taught in

References