title: Could someone explain how AbortComponent works? I cant understand
body: <p>I watch tutorial about React and didnt understand how AbortController works.</p>
  <pre><code>useEffect(() =&gt; {
      const abortCont = new AbortController();
  
      setTimeout(() =&gt; 
          {fetch(url, { signal: abortCont.signal })
              .then(res =&gt; {
                  if(!res.ok) {
                      throw Error('could not fetch the data from that resource');
                  }
                  return res.json();
              })
              .then(data =&gt; {
                  setData(data);
                  setIsPending(false);
                  setError(null);
              })
              .catch((err) =&gt; {
                  if (err.name == 'AbortError'){
                      console.log('fetch aborted');
                  }
                  else {
                      setIsPending(false);
                      setError(err.message);
                  }                   
          })}, 1000);
  
          return () =&gt; abortCont.abort();
  }, [url]);
  </code></pre>
  <p>why he uses return and why this code works when abort didnt happen if I call abort() anyway</p>