Open this example in the interactive library
Live preview
Source code
// 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>
);
}
