Dev Helpers
← Back

Workshop remaining seats

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 WorkshopRemainingSeats({
  searchParams,
}: {
  searchParams: Promise<Record<string, string | string[] | undefined>>;
}) {
  const { count } = await searchParams;
  const requested = Math.max(1, Number(count) || 1);
  return (
    <p>
      {requested <= 6
        ? 6 - requested + " seats remain after this request"
        : "Join the waiting list"}
    </p>
  );
}