Current section: Data fetching 29 exercises
Problem

Error Handling

Loading exercise

Transcript

00:00 So we've got some really nice declarative pending state going on here, but we need some declarative error state. So here's our error boundary. We pulled that from React error boundary, and we can provide a fallback or a fallback component,

00:15 and we have our suspense boundary for the suspending component, so we can show some pending UI. So let's say that we have a typo in our ship name. We're going to say we're trying to load the dread yacht, which is funny to me.

00:33 Then we don't get any sort of feedback to the user. Like, as far as the user is concerned, we're still loading this stuff. Not exactly the experience we want to offer our users, and so we're going to bring in an error boundary to handle that error. Let's go.