State

Derived values during render

Calculate information determined by current props or state without storing an independently synchronized copy.

Formal Syntax & Structure

react syntaxreact
const derived = calculate(state);

Working Example

Example Snippetreact
const units = items.reduce((sum, i) => sum + i.quantity, 0);
React Reference