Dev Helpers
← Back

Shipping weight projection

Place this file at app/print/page.tsx in an App Router project.

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>;
}