Skip to content

Commit

Permalink
some changes
Browse files Browse the repository at this point in the history
  • Loading branch information
r-e-d-ant committed Jul 23, 2022
1 parent cc1d55a commit e49a6cc
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/hooks/useFetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ const useFetch = (url) => {
useEffect(() => {
const abortCont = new AbortController();

if(effectRun.current === 'true') {
fetch(url, {signal: abortCont.signal})
fetch(url, {signal: abortCont.signal})
.then(res => {
if(!res.ok) {
throw Error("Could not fetch the data for that resource");
Expand All @@ -32,8 +31,6 @@ const useFetch = (url) => {
setIsPending(false);
}
});
}
effectRun.current = 'true';

return () => abortCont.abort();
}, [url]);
Expand Down

1 comment on commit e49a6cc

@vercel
Copy link

@vercel vercel bot commented on e49a6cc Jul 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.