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>
)
CodePudding user response:
check it:
const url = `http://openweathermap.org/img/${value?.[0].icon}.png`