State

Canonical state and redundant values

Keep the independently editable inputs as the source of truth; derive dependent summaries.

Formal Syntax & Structure

react syntaxreact
const [items, setItems] = useState(initialItems);

Working Example

Example Snippetreact
const isEmpty = items.length === 0;
React Reference