Open this example in the interactive library
Source code
"use client";
// components/AccessibleChartTableLink.tsx
import { Suspense } from "react";
import Link from "next/link";
import { useSearchParams, usePathname } from "next/navigation";
function AccessibleChartTableLinkContent() {
const p = new URLSearchParams(useSearchParams());
p.set("format", "table");
return <Link href={usePathname() + "?" + p}>Read data as a table</Link>;
}
export default function AccessibleChartTableLink() {
return (
<Suspense fallback={<span>Loading view…</span>}>
<AccessibleChartTableLinkContent />
</Suspense>
);
}
