-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Learn React with TypeScript
By :

In this chapter, we will learn how React can fetch data from a Client Component, reworking the blog post app from the last chapter.
We will start by exploring the challenges of using useEffect
for client-side data fetching. We’ll move on to use a popular library called TanStack Query for client-side data fetching and experience how it simplifies this task. We will maintain the great UX created in the last chapter, using the capabilities in TanStack Query to implement loading indicators and error handling. We will also use TanStack Query to rework the mutation code.
We will cover using React Server Functions for client-side data fetching and understand the downsides of this approach. We’ll also learn how a Next.js Route Handler compares with React Server Functions for client-side data fetching.
By the end of the chapter, you’ll have the knowledge to implement maintainable, robust client-side...