title: For loop not working on first render in useEffect()
body: <p>I have this issue where the <em>first</em> time my component is rendered, anything run inside a for loop (or array.map function) is completely ignored. It runs as expected the second time.</p>
  <pre><code>const myFunctionalComponent = () =&gt; {
      const initialValue = ['RU'];
      const map = useRef(null);
      const [selected, setSelected] = useState(initialValue);
      useEffect(() =&gt; {
          setSelected(initialValue);
          const allPaths = map.current.container.getElementsByTagName('path'); // the array to iterate over
          Array.prototype.map.call(allPaths, path =&gt; console.log(path.id));  // ignored on 1st render ONLY
          console.log(allPaths);
          console.log(selected);
      }, []);
      return (
          &lt;Whatever ref={map} /&gt;
      );
  }
  </code></pre>
  <p>I tried multiple versions, including for of loops AND hardcoding my array instead of getting it with useref from a child component. It worked with a much shorter array, but this cannot be an issue, right?</p>
  <p>I also tried converting the allPaths variable into an array instead of a collection, but to no avail.</p>