Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // the getData function is what contains the fetch call I described above. It's wrapped in `cache` (the standard react function) to have the response be memoized.
- export async function generateMetadata(
- { params }: { params: Promise<{ id: string }> },
- parent: ResolvingMetadata
- ): Promise<Metadata> {
- const id = (await params).id;
- const data = await getData(id);
- if ("error" in data) notFound();
- return {
- // ... some metadata, opengraph stuff
- };
- }
- export default async function Page({
- params,
- searchParams,
- }: {
- params: Promise<{ id: string }>;
- searchParams: Promise<SearchParams>;
- }) {
- const id = (await params).id;
- const data = await getData(id);
- if ("error" in data) notFound();
- return (<>
- //...
- </>)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement