Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
React Query / TanStack Query: React Server State Management
Rating: 4.5 out of 5(2,317 ratings)
16,529 students

React Query / TanStack Query: React Server State Management

Mastering queries, mutations, integration with auth, testing and more!
Created byBonnie Schulkin
Last updated 12/2025
English

What you'll learn

  • React Query version 5 queries, mutations, and cache control
  • Using React Query for pagination, infinite scroll, and optimistic updates
  • Integrating React Query with Authentication
  • Testing React Query

Course content

10 sections88 lectures7h 12m total length
  • Introduction to React Query6:00

    Learn how React Query manages server state in a React app, using a client cache as the source of truth and supporting refetch, prefetch, deduplication, retries, and mutations.

  • Introduction to this Course3:10

    Explore how react query integrates into a larger app through a day spa reservation project, with beginner and advanced tracks, code, and prerequisites for react, hooks, testing, and restful APIs.

  • First project: Blog-em Ipsum5:36

    master fetching blog posts with react query, manage loading and error states, implement pagination and prefetching, and explore mutations, dev tools, and configuring a query client and provider.

  • Adding a Query Client and Provider3:21

    Set up a React Query client and provider to enable useQuery hooks across the app, sharing a central query cache for descendants in a React server state management workflow.

  • Creating Queries with useQuery7:20

    Demonstrates creating useQuery to fetch posts from the json placeholder api, handling data, loading, and error states, and integrating with a query client in React Query.

  • Handling Loading and Error States7:22

    Learn to manage loading and error states with useQuery by destructuring isLoading, isFetching, and isError, using early returns and loading indicators, and handling errors, retries, and the default three tries.

  • React Query Dev Tools5:32

    Learn to install and use React Query dev tools to inspect query status, keys, and data via the data explorer and the query explorer in development.

  • staleTime vs gcTime8:33

    Explore stale time and gc time in React Query, showing how cached data becomes stale and is revalidated, while garbage collection time governs cache expiry.

Requirements

  • Experience with React
  • Familiarity with React Hooks
  • For the testing portion, basic familiarity with Testing Library syntax

Description

Version 5 update released!

As of January 2024, this course covers React Query version 5.

--


React Query (also called TanStack Query) has become the go-to solution for server state management in React apps, and for good reason! This smart, comprehensive solution makes it easy to keep your app up-to-date with data on the server.

In fact, if you are using Redux simply to manage data from the server, React Query can replace Redux in your app. And, for server data management, React Query is much simpler and more powerful than Redux. For example, React Query: 

  • tracks loading and error states for your server queries (no need to manage that yourself!)

  • makes cached server data available for display while you're fetching updated data

This course starts with a simple app to learn the basics of React Query version 3

  • queries

  • loading and error states

  • React Query dev tools

  • pagination and pre-fetching

  • mutations

Then we take a detour with the Star Wars API to learn about Infinite Queries (getting more data just as the user has gotten near the end of the current data).

Finally, we work on a large, multi-component app to learn about the above in more detail, plus

  • centralizing loading and error handling

  • filtering data

  • integrating React Query with auth

  • ways to keep data up to date after mutations, including optimistic updates

  • testing React Query

Other notable course features:

  • pre-written projects to use as a backdrop for React Query, so there's no time wasted writing code not relevant to the course

  • ample opportunities to practice with periodic "code quizzes" to make sure you're understanding the concepts

  • visual models for complicated concepts to help understand all of the moving pieces

  • the major project is written in TypeScript

  • supportive instructor who loves engaging with students in Q&A

Come see what the hype is about, and improve your apps with simpler, more powerful server state management!

Who this course is for:

  • React developers who want to learn an efficient, powerful system for managing server state