Open this example in the interactive library
Source code
// app/editorial/page.tsx
export default async function EditorialDaySheet({
searchParams,
}: {
searchParams: Promise<Record<string, string | string[] | undefined>>;
}) {
const posts = [
{ title: "Paper mills", day: "2028-04-01", desk: "News", words: 840 },
{ title: "At the kiln", day: "2028-04-03", desk: "Art", words: 1500 },
{ title: "City briefs", day: "2028-04-03", desk: "News", words: 540 },
];
const { day } = await searchParams;
return (
<main>
<h1>Assignments</h1>
{posts
.filter((p) => p.day === (day ?? posts[0].day))
.map((p) => (
<p key={p.title}>
{p.desk}: {p.title}
</p>
))}
</main>
);
}
