Open this example in the interactive library
Source code
"use client";
// components/KnownFontQueryPreview.tsx
import { Suspense } from "react";
import { useSearchParams } from "next/navigation";
function KnownFontQueryPreviewContent() {
const f = useSearchParams().get("font");
return (
<p
style={{
fontFamily: f === "mono" ? "monospace" : f === "sans" ? "sans-serif" : "serif",
}}
>
The quick brown fox jumps over the lazy dog.
</p>
);
}
export default function KnownFontQueryPreview() {
return (
<Suspense fallback={<span>Loading view…</span>}>
<KnownFontQueryPreviewContent />
</Suspense>
);
}
