I have a small piece of code from a weather App where it is supposed to look for any city’s weather after searching the name but also fetch the country flag of that city from this website https://www.countryflags.io but it is down now.
I wonder if there is any alternatives to do this in my code?
getWeather();
return () => clearTimeout(loadingIndicatorTimeout);
}, [location]);
const { flagIcon, countryCode } = React.useMemo(() => {
return {
flagIcon: weatherData.sys ? `https://www.countryflags.io/${weatherData.sys.country}/shiny/32.png` : "",
countryCode: weatherData.sys ? weatherData.sys.country : "",
};
}, [weatherData]);
return (
<>
<div className={classes.headerLine}>
<Typography className={classes.location} variant="h5">
{location}
</Typography>
{flagIcon && <img alt={countryCode} src={flagIcon} />}
</div>
<div className={classes.detailLine}>
<LoadingIndicator isLoading={isLoading} />
<ErrorMessage apiError={apiError} />
<WeatherDisplay weatherData={weatherData} />
</div>
</>
);