From the course: Build Modern Web Apps with React, Hooks, State Management, and APIs Using Vite or Next.js

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Deep understanding of fetch and Axios

Deep understanding of fetch and Axios

Welcome back. In this video, we are going to discuss about the handling of loading and error states. In the real applications, we should always be showing loading states before our data arrives. It's very important for a good user experience to let the user know that something is loading behind the scenes and they should be patient. Also, we should always be showing the error messages in case something goes wrong. So eating up the error messages is a very bad practice and it's a very common contributor to bad designs. So your front-end application should always show loading states, it should always show the error in case of errors, as well as it should show properly aligned and fetched data when it was success from the API. As I said, this improves the user experience and it gives user an idea that what's happening behind the scenes. So they won't just sit back thinking that God knows what hope, God knows what's happening behind the scenes. It also prevents your app to breaking or…

Contents