Dev Helpers
← Back

Dietary requests recap

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 Link from "next/link";

export default async function DietaryRequestsRecap({
  searchParams,
}: {
  searchParams: Promise<Record<string, string | string[] | undefined>>;
}) {
  const { meal } = await searchParams;
  const meals = Array.isArray(meal) ? meal : meal ? [meal] : [];
  return (
    <main>
      <h1>Meal requests</h1>
      <ul>
        {[...new Set(meals)].map((m) => (
          <li key={m}>{m}</li>
        ))}
      </ul>
      <Link href="/register">Edit registration</Link>
    </main>
  );
}