It seems like useFetch never fetches data if the depends is something like [''], but sets isLoading to false immediately, i.e. pretending like it finished loading, but just producing the value undefined. This means that if the value in the depends array is a string that might sometimes be empty, data might just happen to be undefined so any code that expects data to exist if isLoading is false fails.
Full component example:
import useFetch from "react-fetch-hook";
function App() {
const { isLoading, data } = useFetch("https://api.github.com/", {depends:['']});
console.log(data);
return (
<p>
{JSON.stringify(data)}
</p>
);
}
export default App;
I'm not sure if this is intended or not, but given that there are situations where depends might include a sometimes empty string, I assume not.