Hello everyone !
I am a student creating a "weather" tab for a mobile application project.
I am using the OpenWheatherMap API, "One Call API" precisely and I have a small problem. To receive the information from the API here is what I do:
1.WeatherScreen.js
And this is the error I got (I know the meaning of it but don't know how to bypass it) :
If someone can indicate me what to do it will be awesome !
Thanks in advance and good day / good night !
You are destructuring currentWeather
and you have temp
in both current
and daily
and you have icon
in both weather
and daily
. Destructuring is fine but you need to alias those fields so you don't end up with re-declaration of temp
and icon
.
Here is an example:
const { current: { temp: currentTemp, humidity, wind_speed },
// etc.
daily: { temp, icon },
// etc.
}
This way, temp
variable is not duplicated and will point to daily temperature and currentTemp
will point to current temperature.