Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumReactuseCallbackSingle-choice MCQ

A recursive component computes a derived value from its `node` prop on every render and recurses. To prevent recomputation on unrelated parent renders you consider useCallback. Why is useCallback the WRONG tool for memoizing the derived VALUE here?

function Node({ node }) { const total = node.items.reduce((a, b) => a + b.cost, 0); // ... }