DEV Community

Discussion on: Custom React useFetch() hook for data fetching with revalidation

Collapse
 
damiisdandy profile image
damilola jerugba • Edited

It sets error to true, which displays

if (error) {
    return <h2>Error fetching users</h2>;
  }
Enter fullscreen mode Exit fullscreen mode
Collapse
 
kylesureline profile image
Kyle Scheuerlein

Are you sure? It looks like data would be falsy (if the fetch errors out!) and so your second if block can never run.

Thread Thread
 
damiisdandy profile image
damilola jerugba • Edited

git clone the repo and look for yourself, if this is really an issue please add an issue to the repo or try to contribute to it 💜