Open this example in the interactive library
Live preview
Source code
// components/GramToOunceLedger.tsx
export default function GramToOunceLedger({
grams = [120, 80, 50],
}: { grams?: number[] } = {}) {
return (
<table>
<tbody>
{grams.map((g, i) => (
<tr key={i}>
<th>{g} g</th>
<td>{(g / 28.3495).toFixed(2)} oz</td>
</tr>
))}
</tbody>
</table>
);
}
