title: UseEffect being called multiple times
body: <p>I thought <code>useEffect</code> is called once only after render, but it's being executed multiple times and not in the order I expected.</p>
  <p>I expected it to msg 'data loading' while the fetch is in progress and then once fetch is done, render the title field and alert &quot;..Done...&quot; once and that should be the end.</p>
  <p>I added ALERT and console logs at the two points to determine the flow and both alerts and console logs appear more than once and in different orders. Could you kindly run this code and see the behaviour. I kept the 2nd argument array as null to make it run once only but does not help.</p>
  <p>Please clarify if react RENDER means DISPLAY on screen? what stage does LOAD indicate? When is the display done?</p>
  <p>code follows:</p>
  <pre class="lang-js prettyprint-override"><code>import React, { useEffect, useState } from &quot;react&quot;;
  //import &quot;./App.css&quot;;
  
  function DemoFetchZ() {
    let data = { title: &quot;Waiting for Data&quot; };
    const [todo, setTodo] = useState(data);
    const [isData, setData] = useState(false);
    const [isFetching, setFetching] = useState(false);
  
    useEffect(() =&gt; { // called after the first render
      async function fetchData() {
        setFetching(true);
        const response = await fetch(
          &quot;https://jsonplaceholder.typicode.com/todos/1&quot;
        );
        console.log(&quot;response = &quot;, response);
        let data = await response.json();
        setTodo(data); //updt state
          setFetching(false);
          setData(true)
        console.log(&quot;Data = &quot;, data);
      }
      fetchData();
    }, []); //[isData] null value will execute once only?
  
    if (isFetching) {
        console.log(&quot;data loading ......&quot;)
        alert (&quot;data loading&quot;)
        return (&lt;div&gt;...Data Loading.....&lt;/div&gt;);
    }
  
    return (
      &lt;div&gt;
             - Fetch
            &lt;br /&gt; {alert(&quot;..DONE...&quot;)}
        &lt;span&gt;Title: {todo.title}&lt;/span&gt;
      &lt;/div&gt;
    );
  }
  
  export default DemoFetchZ;
  </code></pre>