Open this example in the interactive library
Source code
// app/preferences/page.tsx
import { cookies } from "next/headers";
export default async function PreferredUnitLabel() {
const jar = await cookies();
const metric = jar.get("units")?.value !== "imperial";
return <p>Desk width: {metric ? "120 cm" : "47.2 in"}</p>;
}
