Dev Helpers
← Back

Footnotes URL preference

Place this file at components/FootnotesURLPreference.tsx in an App Router project.

Open this example in the interactive library

Source code

"use client";

// components/FootnotesURLPreference.tsx

import { Suspense } from "react";

import { useSearchParams } from "next/navigation";

function FootnotesURLPreferenceContent() {
  const q = useSearchParams();
  const visible = q.get("notes") === "show";
  return (
    <article>
      Printed in 1924.{visible && <aside>Source: studio archive, volume two.</aside>}
    </article>
  );
}

export default function FootnotesURLPreference() {
  return (
    <Suspense fallback={<span>Loading view…</span>}>
      <FootnotesURLPreferenceContent />
    </Suspense>
  );
}