![android](https://habrastorage.org/r/w120/webt/5b/0d/67/5b0d6718e4b6b295356228.png)
Android
- 13 ответов
- 0 вопросов
3
Вклад в тег
const getWeather = React.useCallback(async () => {
try {
setLoading(true);
const response = await axios(urlCoords);
const data = await response.data;
setData(data);
setLoading(false);
} catch (error) {
alert('Failed to load resource');
console.error(error);
setError(error);
setLoading(false);
}
setLocation('');
}, []);
React.useEffect(() => {
if (lat && long) {
getWeather();
}
}, [lat, long, getWeather]);