Batch weight combines quantity and unit weight. Convert all measurements to the same unit before aggregating them.
Worked example
// components/BatchWeightSummary.tsx
export default function BatchWeightSummary({
grams = [120, 80, 50],
servings = 2,
}: { grams?: number[]; servings?: number } = {}) {
return (
<p>
Batch {grams.reduce((a, b) => a + b, 0)} g · {servings} portions
</p>
);
}Implementation notes
Keep units in the labels of both inputs and outputs. A valid numeric total can still be wrong if kilograms and grams enter the same multiplication.
Try it yourself
Compare one heavy item with several lighter items of the same total weight.
Open the React example →Editorial date November 1, 2026 · Published December 6, 2026