fetchweatherapi_reacthook
v1.1.1
Published
fetch hook for https://api.weatherapi.com
Downloads
2
Readme
This custom hook is created for https://www.weatherapi.com/ . It accepts 2 parameters (city, API) and returns the object { isLoaded, setIsLoaded, error, weatherData }.
isLoaded - boolean state (indicates if fetch completed or not).
setIsLoaded - lets you change "isLoaded" state.
error - if it's empty "", means request was made succesfully and city was found. Otherwise it returns the error content. weatherData - this data changes only if the request was succesfull and city was found.
Recommended usage:
const { isLoaded, setIsLoaded, error, weatherData } = useFetchWeatherApi( city, yourAPI );