Dev Helpers
← Back

Party size allocation

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

Open this example in the interactive library

Source code

// app/register/page.tsx

export default async function PartySizeAllocation({
  searchParams,
}: {
  searchParams: Promise<Record<string, string | string[] | undefined>>;
}) {
  const { size } = await searchParams;
  const n = Math.max(1, Math.min(80, Math.trunc(Number(size) || 1)));
  return (
    <p>
      Reserve {Math.ceil(n / 8)} tables of eight for {n} attendees.
    </p>
  );
}