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.

Common mistakes: Practices and summary

Common mistakes: Practices and summary

Hello and welcome back. In this video, we are going to see the common mistakes which we should be avoiding. The first one is forgetting to add an update. The first one is forgetting to add an await keyword before making your exeuse calls. So before making any exeuse.get or api.get and post calls, you should be placing an await if you are using an async await syntax. If you are not using an async await syntax or you are using the .then and .catch syntax, then we should be always be handling the .catch function. If the promise is being rejected, we should be showing on a decent error to a good user experience. So, our user knows that there has been an error while calling the backend API. failing to update the local state after successful post or delete. In the previous example, where we were doing an edit and update or delete, if we are not going to update the products list, then it can have inconsistency in our UI, where the product has been deleted in the backend, but it is still…

Contents