Dev Helpers
← Back

Dismissed banner preference

Place this file at app/preferences/page.tsx in an App Router project.

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 DismissedBannerPreference() {
  const jar = await cookies();
  return (
    <main>
      {jar.get("dismissed-news")?.value !== "1" && (
        <aside>New workshops are available.</aside>
      )}
      <Link href="/workshops">Browse workshops</Link>
    </main>
  );
}