Skip to content

TanStack 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

Facts at a glance
Preact compatibility
Unverified
Tested Preact versions
Not documented
TypeScript
Native TypeScript
SSR
SSR supported
Maintenance
Active
License
MIT
Last verified
Not yet verified
Terminal
npm install @tanstack/react-query
Preact example
import { 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.

Alternatives