Search⌘ K

Data Re-Fetching in React

Explore how to shift from client-side to server-side data fetching in React by using dynamic search terms. Learn to manage state and implement side effects that trigger data re-fetching only when necessary. This lesson helps you optimize API calls and improve application performance by handling real-time user input effectively.

We'll cover the following...

So far, the App component fetches a list of stories once with a predefined query (‘react’). After that, users can search for stories on the client-side. Now we’ll move this feature from client-side to server-side searching, using the actual searchTerm as a dynamic query for the API request.

First, remove searchedStories, ...