title: issue with useEffect understanding.Infinite loop runs when not passing any dependency array
body: <p>I am fetching data inside <code>useEffect</code> and updating the local state when data arrives. But If I dont pass dependency array to <code>useEffect</code>, the state is updated but it runs infinite loop. On the other hand if I pass dependency array as empty or with state, then it does not update the state (i.e) data is not set into the local state variable from my axios request.</p>
  <pre><code>const [availableCars, setAvailableCars] = useState([]);
  
  useEffect(() =&gt; {
    postRequest(formData, headers).then((data) =&gt; {
      console.log('Vehicles Response:', data);
      console.log('Vehicles Response:', data.status);
  
      if (data.status == 'ok') {
        const vehiclesData = data.vehicles;
        setAvailableCars(vehiclesData);
      }
    });
  }, []);
  </code></pre>