Are you tired of wrestling with useEffect and manual data fetching in React? Writing multiple pieces of state for one query and having to follow weird practices to get your query to work correctly? In this video, I’ll show you how to leave those frustrations behind and level up your querying game using TanStack Query. We’ll dive straight into the awesome features of TanStack Query, from simple setup steps to powerful caching and lightning fast and efficient queries.
TanStack Query was formerly known as React Query, so don't let the names confuse you, TanStack is just the latest and greatest iteration! TanStack Query/React Query is, from what I have seen, the most widely used querying tool for professional, real-world React apps. That's why this video will help you get started with it, so you can be on your way to becoming a querying god!
Here’s what you’ll learn:
• How TanStack Query simplifies React data fetching, caching, and updates
• Step-by-step setup to get TanStack Query running in your React app
• Hands-on examples of query caching
• Best practices to make your app more performant and code more maintainable
🏖️TanStack Query: https://tanstack.com/query/latest/docs/framework/react/overview
This is by no means a top to bottom tutorial for TanStack Query, rather it's all the essential tools to get you started. In future videos we'll discuss things like query invalidation, stale data, and data synchronization.
Timestamps:
0:00 - Intro/Overview
0:54 - Installation & Setup
2:24 - useQuery()
5:00 - Why TanStack is goated
6:26 - Loading states, error states, refetching, etc.
10:22 - Query options (parameters)
13:44 - Conditional Querying (kinda)
14:53 - Reusable Queries
17:17 - TypeScript safety
20:19 - useSuspenseQuery()
21:39 - Suspense Component
24:15 - Multiple queries