Closed 2b32dn closed 1 year ago
React is throwing an error whenever I try to retrieve the front_default image in official-artwork. I believe that there's a typo and it should official_artwork instead
front_default
official-artwork
official_artwork
The error: Main.jsx:11 Uncaught ReferenceError: artwork is not defined
{pokemon.map((pokemon) => ( <> <h1>{pokemon.name}</h1> <img src={pokemon.sprites.other.official-artwork.front_default} placeholder={`${pokemon.name} Default Official Image`} /> {console.log(pokemon.sprites.front_default)} </> ))}
You cant use dot notation with keys that contain dashes. Use [] notation
[]
React is throwing an error whenever I try to retrieve the
front_default
image inofficial-artwork
. I believe that there's a typo and it shouldofficial_artwork
insteadThe error: Main.jsx:11 Uncaught ReferenceError: artwork is not defined