Dev Helpers
← Back

Server range selection

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