React 18 for Beginners - Unable to display games with NO platform icons

I’ve implemented SEARCH BAR and all is great unless I search and find games that do not have any platform icons. To recreate this, search for HALF. One of the half-life games does not have any platform icons.

The bad game is: Half-Life 2: Downfall

To fix this, we need to check for NULL (truthy) in GameCard.tsx. Here’s the fix:

{game.platforms && (
  <PlatformIconList platforms={game.platforms?.map((p) => p.platform)}
  />

Anywhere you might call MAP, you need to confirm your data is there first.

Coding for dollars!
Jerry

@Mosh

Hi Jerry! Thanks for reporting this. I just fixed the issue and made a commit. You can verify it’s working at https://game-hub-phi.vercel.app/