Files
nextjs-address-book/src/app/(sidebar)/contacts/[contactId]/page.tsx

20 lines
471 B
TypeScript

import { notFound } from "next/navigation";
import Contact from "@/app/(sidebar)/contacts/[contactId]/Contact";
import { fetchContact } from "@/app/(sidebar)/loaders";
export default async function ContactPage({
params
}: {
params: Promise<{ contactId: string }>
}) {
const { contactId } = await params;
const contact = fetchContact(contactId).then((c) => {
if (c === null) notFound();
return c;
});
return (
<Contact contact={contact}/>
);
}