0

Same situation as in this How to display openweathermap weather icon

Why I cannot get an id for icon, with this code ?

const value = weather.weather
        console.log('icon', value)
        console.log('icon', value[0].icon)
        const url = `http://openweathermap.org/img/${value[0].icon}.png`
        return(
            <div>
                <div> temperature {weather?.main?.temp} Celcius</div>
                <img src='url' alt="icon" width="120" height="100"></img>
                <p>wind {weather?.wind?.speed} m/s</p>
            </div>
            
        )
CoderLBY
  • 89
  • 9

1 Answers1

0

check it:

const url = `http://openweathermap.org/img/${value?.[0].icon}.png`
Vida Hedayati
  • 328
  • 1
  • 7