title: Create React App + Contentful infinite request loop
body: <p>I started to follow the following tutorial:
  <a href="https://blog.logrocket.com/using-a-headless-cms-with-react/" rel="nofollow noreferrer">https://blog.logrocket.com/using-a-headless-cms-with-react/</a></p>
  <p>Unfortunately once I completed it I noticed my <code>Network</code> tab in chrome started going crazy AFTER I navigated to one of the child items:</p>
  <p>Here is the reduced code version: <a href="https://codesandbox.io/s/react-contentful-hx0de?from-embed" rel="nofollow noreferrer">https://codesandbox.io/s/react-contentful-hx0de?from-embed</a></p>
  <p>I figured it must be how its being called from Contentful in this snippet that uses a promise to get the results:</p>
  <pre><code>export default function useSinglePost(slug) {
    const promise = getSinglePost(slug);
  
    const [post, setPost] = useState(null);
    const [isLoading, setLoading] = useState(true);
  
    useEffect(() =&gt; {
      promise.then(result =&gt; {
        setPost(result[0].fields);
        setLoading(false);
      });
    }, [promise]);
  
    return [post, isLoading];
  }
  
  </code></pre>
  <p>But I cant figure out why I get this infinite loop of network requests.</p>
  <p><a href="https://i.stack.imgur.com/t83Ly.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/t83Ly.gif" alt="enter image description here" /></a></p>