Skip to content

Commit

Permalink
Added change to PokeInfo img OnError
Browse files Browse the repository at this point in the history
Added a default image for a Pokémon's info
  • Loading branch information
Namatuzio committed Oct 20, 2023
1 parent 69d3513 commit 80b8d80
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/components/PokemonInfo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ const PokemonInfo = ({ selectedPokemon, setInfoOpen }) => {
src={`https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/${id}.png`}
alt="image"
className='w-[70%]'
onError={(e) => {
e.target.onerror = null;
e.target.src = "/assets/pokeball.png";
}}
/>
<h1 className='capitalize text-3xl font-medium text-center'>{selectedPokemon.name}</h1>
</div>
Expand Down

0 comments on commit 80b8d80

Please sign in to comment.