Data for Reduxs
RTK Query is the data fetching and caching tool included in Redux Toolkit. You describe endpoints with createApi, and it generates hooks that fetch data, cache it by arguments, track loading and error states, and refetch when tags are invalidated. It removes most hand-written thunks and reducers for server data.
Stage: Building Features · Part of the Redux roadmap · Last reviewed 19 November 2026
What to learn in Data
- Define an API slice with createApi and fetchBaseQuery
- Use generated query hooks to read data and track isLoading
- Send changes with mutation hooks
- Refresh stale data with providesTags and invalidatesTags
- Customise cache lifetime and polling for an endpoint
Data interview questions
How does RTK Query know when to refetch data?
Queries declare tags they provide, and mutations declare tags they invalidate. When a mutation finishes, any cached query with a matching tag is marked stale and refetches. It also refetches on argument changes and can be configured to refetch on focus or reconnect.
When is RTK Query a better choice than createAsyncThunk?
For ordinary server data it is usually better, since it supplies caching, deduplicated requests and generated hooks. Thunks fit custom workflows that are not simple fetches, such as multi-step operations that combine several calls and store updates.
Where Data fits in the Redux roadmap
Data belongs to the Building Features stage (intermediate level). Real apps.
Other units in this stage
Back to the full Redux roadmap