Dev Helpers
← Back

Badge name proof

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 BadgeNameProof({
  searchParams,
}: {
  searchParams: Promise<Record<string, string | string[] | undefined>>;
}) {
  const { name } = await searchParams;
  return (
    <main>
      <Form action="/register">
        <label>
          Badge name
          <input name="name" maxLength={45} />
        </label>
        <button>Proof badge</button>
      </Form>
      <strong>{typeof name === "string" ? name : "Your name"}</strong>
    </main>
  );
}