useQuery
useQuery is a TanStack Query hook for asynchronously fetching and caching data while exposing its data, status, and error state.
React Hooks in Action: With Suspense and Concurrent Mode
useQuery is a React Query hook that fetches asynchronous data and returns its data, status, and error state while managing cached results.
- How it is used
- Fetches and caches server state so shared views remain responsive during navigation and avoid repeated loading indicators.
- How deep it goes
- Explains provider setup, query keys, returned state, cache reuse, background fetching, and an experimental Suspense option, without implementation internals.
- Examples
- Demonstrates bookables, bookings keyed by identifiers and dates, cached edit-form data, loading states, errors, and Suspense.
- What you can do after
- Build responsive data-driven components with React Query, shared caching, query-specific keys, status handling, and cached initial data.
Read how React Hooks in Action: With Suspense and Concurrent Mode explains useQuery →
React in Depth
useQuery is a TanStack Query hook that declares and retrieves asynchronously fetched data for a component.
- How it is used
- Declares component-level server-data queries and exposes results for rendering.
- How deep it goes
- Explains query functions, cache-oriented keys, loading state, and asynchronous data without covering hook internals.
- Examples
- Uses customer lists, individual customers, paginated results, name searches, and a loading branch.
- What you can do after
- Apply it via TanStack Query to fetch, identify, and render asynchronous data in a component.
Related concepts
- TanStack Queryuses · TanStack Query is a library for fetching, caching, synchronizing, and updating asynchronous server state.
- query keyuses · A query key is a structured array identifier that uniquely describes a data query and its parameters for caching and lookup.
- useMutationalternative to · useMutation is a TanStack Query hook for executing server-side data mutations and exposing their status and operations.
- React Queryused by · React Query is a library for fetching, caching, synchronizing, and updating asynchronous server state in React applications.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

