Search⌘ K

Error Handling

Explore how to manage API errors in a React V15 class component by using local state and conditional rendering. This lesson guides you through capturing errors from failed fetch requests and displaying user-friendly messages while maintaining app functionality.

We'll cover the following...

In this lesson, we introduce an efficient solution to add error handling for the application that we are building in case of an erroneous API request. We must know the necessary building block to introduce error handling in React: local state and conditional rendering. The error is just another state, which we store in the local state and display with conditional rendering in the component.

Now, we’ll implement it in the ...