Current section: Suspense img 29 exercises
Problem

Img Component

Loading exercise

Transcript

00:00 Here's what we need to do to solve the image problem for this step of the exercise. I want you to open up your DevTools, go to the Network tab, and then I want you to hard refresh. So right-click on this, empty cache, and hard reload, or however your browser does it. Just get that cache emptied.

00:19 And then change this to a throttled slow 3G network so you have some time to see what's going on. And then choose one of the other ships. And you'll notice that the wrong image is showing up for the wrong description, and that's because the image for the ship is showing up here.

00:35 And so what we want is for nothing to change until the ship is loaded. That means we need to suspend on the ship's image until that image is loaded. We've got a utility for loading that, so we've got a utility for generating a promise out of loading the image. And so that is what we're going to be doing in this exercise

00:54 is using that to force the image component to suspend. So let's make that image component and get it suspending.