Library
Data FetchingTanStack Query
Async state management and data fetching for Preact applications.
UnverifiedActive
Unverified
Compatibility has not been verified yet in the PreactHub catalog.
Package@tanstack/react-query
npm install @tanstack/react-queryimport { QueryClient, QueryClientProvider, useQuery } from "@tanstack/react-query"; const client = new QueryClient(); function Posts() { const query = useQuery({ queryKey: ["posts"], queryFn: async () => fetch("/api/posts").then((res) => res.json()), }); return <pre>{JSON.stringify(query.data, null, 2)}</pre>;} export function App() { return <QueryClientProvider client={client}><Posts /></QueryClientProvider>;}Known limitations
- Treat current compatibility as not yet verified in this directory.
Introduction
TanStack Query is a popular choice for server-state caching, retries and background revalidation.
Preact configuration
In many Preact projects this package is used through `preact/compat`. Verify your app-level aliasing before recommending it for production.
SSR notes
The package supports hydration patterns, but compatibility details should be verified in the exact Preact stack you run.
Islands notes
Can be useful inside data-heavy interactive islands.