title: REACT state update with loop overrides previous values
body: <p>I have this simple function to update the state in React.
  It takes a simple URL from URLs array then fetch additional data and create newItem
  It should update Another state which is also array with this new object.
  But it override first item with every another.
  Why its like that ?</p>
  <pre><code>for (const item of urls) {
    const url = item.url
    const ID = url.slice((url.search(&quot;=&quot;,0) + 1), url.length)
    const YtResponse = GetByIdYouTube(ID)
    const data = await YtResponse
    const date = item.date
    const newItem = {data, url, date}
    setDisplay(display.concat(newItem))
  }
  
  }; ```
  </code></pre>