Too Long; Didn't Read
We can create a custom hook that will be used to handle all asynchronous data fetching and updating the state updating. Data fetching logic is the same logic that is used to fetch data and update the state. We are showing a loading indicator to show the user that the app is loading data, and hiding the content until the data is ready. The third thing is that we are setting the data to the state that we got back from the API. We can also create a flexible component that is more flexible than the traditional component lifecycle.