title: React Native setState add's last item of the array
body: <p>So i got a <code>setState</code> named <code>items</code> <code>const [items, setItems] = React.useState([]);</code></p>
  <p><strong>My Items Array Structure</strong></p>
  <pre><code>[{
    &quot;id&quot;: &quot;0.625240011345925&quot;,
    &quot;item_name&quot;: &quot;Item 23&quot;,
    &quot;item_price&quot;: &quot;23&quot;,
    &quot;item_qty&quot;: &quot;1&quot;
  }, {
    &quot;id&quot;: &quot;0.735657461482515&quot;,
    &quot;item_name&quot;: &quot;Item 4&quot;,
    &quot;item_price&quot;: &quot;30&quot;,
    &quot;item_qty&quot;: &quot;1&quot;
  }, {
    &quot;id&quot;: &quot;0.287635530963835&quot;,
    &quot;item_name&quot;: &quot;Item 2&quot;,
    &quot;item_price&quot;: &quot;56&quot;,
    &quot;item_qty&quot;: &quot;1&quot;
  }]
  </code></pre>
  <p><strong>Main Function</strong></p>
  <pre><code>    const AddItemToBill = (navigation) =&gt; {
      navigation.navigate('AddItemToBill', {
          onReturn: (itemArray) =&gt; {
              const array = itemArray;
              for (let i = 0; i &lt; array.length; i++) {
                  const element = array[i];
                  setItems([...items, element]);
                  console.log('Items: ' + JSON.stringify(array))
              }
          }, navigation
      })
  };
  </code></pre>
  <p><strong>Check issue in below Gif</strong></p>
  <p><a href="https://i.stack.imgur.com/8K6xP.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8K6xP.gif" alt="enter image description here" /></a></p>