Dev Helpers
← Back

Server keyword summary

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

Open this example in the interactive library

Source code

// app/search/page.tsx

export default async function ServerKeywordSummary({
  searchParams,
}: {
  searchParams: Promise<Record<string, string | string[] | undefined>>;
}) {
  const q = (await searchParams).q;
  return (
    <main>
      <h1>Search</h1>
      <p>
        {typeof q === "string" && q.trim()
          ? "Results for " + q.trim()
          : "Enter a search term."}
      </p>
    </main>
  );
}