Open this example in the interactive library
Source code
// app/species/[id]/page.tsx
import { notFound } from "next/navigation";
export default async function BirdwatchingPocketCard({
params,
}: {
params: Promise<{ id: string }>;
}) {
const entries = [
{
id: "robin",
name: "American robin",
group: "Thrush",
months: [3, 4, 5, 6, 7, 8, 9],
},
{
id: "junco",
name: "Dark-eyed junco",
group: "Sparrow",
months: [1, 2, 3, 10, 11, 12],
},
];
const { id } = await params;
const bird = entries.find((b) => b.id === id);
if (!bird) notFound();
return (
<article style={{ maxWidth: "25ch", border: "1px solid", padding: 12 }}>
<h1>{bird.name}</h1>
<p>{bird.group}</p>
<small>Likely in {bird.months.length} months of the year</small>
</article>
);
}
