Dev Helpers
← Back

Next editorial deadline

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

Open this example in the interactive library

Source code

// app/editorial/page.tsx

export default async function NextEditorialDeadline({
  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 { after } = await searchParams;
  const next = posts.find((p) => p.day > String(after ?? ""));
  return <p>{next ? next.day + ": " + next.title : "No scheduled stories"}</p>;
}