What is TanStack Query (React Query)?

Turkish: TanStack Query

TanStack Query manages server data in React apps through query keys, caching, background refresh, and synchronization.

What is TanStack Query?

TanStack Query is a library focused on managing data that comes from a server in React and other modern frontend applications. It was formerly known as React Query. It does not manage local UI state such as form fields or whether a modal is open; it manages server data that is fetched, cached, and eventually becomes stale.

Its core concepts are query keys, query functions, cache, stale time, and refetching. When the same data is used in different components, the cache can be shared instead of sending repeated requests. Data can refresh automatically when the network reconnects, the window regains focus, or a configured interval passes.

Application Use

In React projects, TanStack Query is commonly used for REST API resources such as product lists, user profiles, order details, and dashboard data. Mutations handle write operations, while optimistic updates can give the user fast feedback before the server response completes.

TanStack Query does not replace backend validation and is not the right tool for every kind of global UI state. It works best when API error formats, cache timing, invalidation rules, and loading or error screens are designed together with the product experience.