Open this example in the interactive library
Source code
// app/regions/[code]/page.tsx
import { notFound } from "next/navigation";
export default async function NativeRegionNameHeading({
params,
}: {
params: Promise<{ code: string }>;
}) {
const places = [
{
code: "ca",
lang: "en-CA",
currency: "CAD",
zones: ["America/Toronto", "America/Vancouver"],
},
{ code: "jp", lang: "ja-JP", currency: "JPY", zones: ["Asia/Tokyo"] },
];
const { code } = await params;
const place = places.find((p) => p.code === code);
if (!place) notFound();
return (
<h1 lang={place.lang}>
{new Intl.DisplayNames([place.lang], { type: "region" }).of(code.toUpperCase())}
</h1>
);
}
