Open this example in the interactive library
Source code
// app/print/page.tsx
export default async function ShippingWeightProjection({
searchParams,
}: {
searchParams: Promise<Record<string, string | string[] | undefined>>;
}) {
const { gsm, sheets } = await searchParams;
const grams =
0.21 * 0.297 * Math.max(0, Number(gsm) || 80) * Math.max(1, Number(sheets) || 100);
return <output>{grams.toFixed(0)} g of A4 paper before packaging</output>;
}
