npm install swrimport useSWR from "swr"; const fetcher = (url: string) => fetch(url).then((res) => res.json()); export function User() { const { data } = useSWR("/api/user", fetcher); return <pre>{JSON.stringify(data, null, 2)}</pre>;}swrData fetching with stale-while-revalidate semantics and a small API surface.
Compatibility has not been verified yet in the PreactHub catalog.