The official and exclusive guide to mastering server-state in your applications, straight from the original creator and maintainer of the library.
Data Fetching in React sucks.
You've likely tried countless "global state" libraries, useFancyPromise hooks and maybe even attempted to write your own solutions only to end up back in the same place: Writing TONS of code to handle seemingly endless data fetching scenarios. But WHY?
Server state and client state are fundamentally different.
- Is persisted remotely in a location you do not control
- Requires asynchronous APIs for fetching and updating
- Implies shared ownership and can be changed by others without your knowledge
- Will eventually become "stale" or "outdated" during the lifecycle of your app.
So, it's time we stop trying to force server-state into our client-state tools and instead, harness the power of its unique challenges for our benefit:
- Caching... (possibly the hardest thing to do in programming, but game-changing)
- Deduping multiple requests for the same data into a single request
- Updating out of date data in the background
- Controlling when data is "out of date"
- Performance optimizations like pagination and lazy loading data
- Managing memory and garbage collection of server state
- Optimistic updates and rollbacks for "instant" UI and user experiences.
React Query turns these challenges into powerful features.
It is the best tool available for solving all of these issues out-of-the-box, with zero configuration, and allowing for fine-grained customization as your application grows.
What will I learn?
In this course, you will learn how to wield React Query as your go-to weapon of choice for defeating and overcoming the challenges and hurdles of server state. You will learn to control your asynchronous data in your apps before it starts to control you.
At the end of this course, you will:
- Have a better understanding of server-state and its unique challenges, patterns and how to solve for them
- Be a master of caching, and have the tools and knowledge to configure it, instead of implementing it by hand yourself.
- Know the entire core React Query API and how to pragmatically use all of it's unique features in your applications
- Remove many lines of complicated and misunderstood data fetching code from your application and replace them with just a handful of lines of React Query logic.
- Make your application more maintainable and easier to build new features without worrying about wiring up new server state data sources
- Have a direct impact on your end-users by making your application feel faster and more responsive than ever before.