Dev Helpers
← Back

Ticket tier quote

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

import Form from "next/form";

export default async function TicketTierQuote({
  searchParams,
}: {
  searchParams: Promise<Record<string, string | string[] | undefined>>;
}) {
  const { tier } = await searchParams;
  const price = tier === "student" ? 25 : tier === "team" ? 180 : 60;
  return (
    <main>
      <Form action="/register">
        <select aria-label="Ticket tier" name="tier">
          <option>standard</option>
          <option>student</option>
          <option>team</option>
        </select>
        <button>Quote</button>
      </Form>
      <output>{price} CAD</output>
    </main>
  );
}