React performance

memo comparator

Custom comparison must return true only when new props preserve output and behavior.

Formal Syntax & Structure

react syntaxreact
memo(Plot, (a, b) => a.onInspect === b.onInspect && equalPoints(a.points, b.points))

Working Example

Example Snippetreact
memo(Plot, (a, b) => a.onInspect === b.onInspect && equalPoints(a.points, b.points))
React Reference