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>
);
}
