{{PR_TITLE}} #{{PR_NUMBER}}

by {{PR_AUTHOR}} · generated {{GENERATED_AT}}
{{N_MUSTFIX}} must-fix {{N_CONSIDER}} consider {{N_PRAISE}} praise

{{FILE_PATH}}

consider Unnecessary memoization {{FILE_PATH}}:42
const total = useMemo(() => items.reduce((a, b) => a + b.price, 0), [items]);return <Cart total={total} />;

The sum runs over a small array and is cheap; useMemo here adds a dependency array and a stale-closure surface for no measurable gain. Memoization pays off only when the work is expensive and the reference feeds a memoized child or effect.

Before

const total = useMemo(
() => items.reduce((a, b) => a + b.price, 0),
[items]
);

After

const total = items.reduce(
(a, b) => a + b.price,
0
);