Open this example in the interactive library
Source code
// app/stores/[branch]/page.tsx
import { notFound } from "next/navigation";
export default async function WeeklyPickupCapacity({
params,
}: {
params: Promise<{ branch: string }>;
}) {
const branches = [
{ key: "market", opens: 9, closes: 18, sat: true, stock: 12 },
{ key: "pier", opens: 11, closes: 19, sat: false, stock: 4 },
];
const { branch } = await params;
const store = branches.find((b) => b.key === branch);
if (!store) notFound();
return (
<output>
{(store.closes - store.opens) * (store.sat ? 6 : 5)} one-hour slots per week
</output>
);
}
