Open this example in the interactive library
Source code
// app/search/page.tsx
export default async function ServerRangeSelection({
searchParams,
}: {
searchParams: Promise<Record<string, string | string[] | undefined>>;
}) {
const { from, to } = await searchParams;
return (
<main>
<h1>Reporting period</h1>
<dl>
<dt>From</dt>
<dd>{typeof from === "string" ? from : "Any date"}</dd>
<dt>To</dt>
<dd>{typeof to === "string" ? to : "Today"}</dd>
</dl>
</main>
);
}
