Open this example in the interactive library
Source code
// app/preferences/page.tsx
import Link from "next/link";
import { cookies } from "next/headers";
export default async function LastViewedSectionShortcut() {
const jar = await cookies();
const saved = jar.get("last-section")?.value ?? "";
const safe = ["guide", "studio", "projects"].includes(saved) ? saved : "guide";
return <Link href={"/" + safe}>Resume {safe}</Link>;
}
