Summary
In this chapter, we learned more about using the useQuery
hook to solve some common challenges we are presented with when dealing with the server state. By now, you can handle all your data fetching needs and do it easily.
You learned about parallel queries and learned you could manually build these queries with useQuery
. You were also introduced to one alternative of the useQuery
hook: useQueries
. With it, you learned how to build dynamic parallel queries.
You got to learn more about some methods of QueryClient
that allow you to prefetch, cancel, and invalidate queries and also understood how you can leverage QueryFilters
to customize the query matching used in these methods.
Pagination is a typical UI pattern, and now you know that you can easily build a paginated component with the help of useQuery
and one of its options.
Another typical UI pattern is infinite scrolling. With the help of another useQuery
variant called useInfiniteQuery
, you learned how React...