title: React : Pushing result of map() to an array
body: <p>Hello I am trying to map through an array of objects and push them to a new array.</p>
  <p>My ISSUE : only the last item of the object is being pushed to the new array</p>
  <p>I believe this has to do with  React life cycle methods but I don't know where  I should I loop and push the values to the array to get the full list</p>
  <pre><code>
  //My object in an array named states
  var states = [{&quot;_id&quot;:&quot;Virginia&quot;,&quot;name&quot;:&quot;Virginia&quot;,&quot;abbreviation&quot;:&quot;VN&quot;,&quot;__v&quot;:0},{&quot;_id&quot;:&quot;North Carolina&quot;,&quot;name&quot;:&quot;North Carolina&quot;,&quot;abbreviation&quot;:&quot;NC&quot;,&quot;__v&quot;:0},{&quot;_id&quot;:&quot;California&quot;,&quot;name&quot;:&quot;California&quot;,&quot;abbreviation&quot;:&quot;CA&quot;,&quot;__v&quot;:0}];
  
  export function StateSelect()
  {
     **EDIT 1**
      const options = [];
  
   function getStates()
  {
  //This is how I am looping through it and adding to an array
  
     { states.length &gt; 0 &amp;&amp;
      states.map(item =&gt;
      (
        console.log(`ITEM: ${JSON.stringify(item)}`),
        options.push([{ value: `${item.name}`, label: `${item.name}`}])
       ))
     }
  }
  
  return(  {getStates()}: );
  
  }
  </code></pre>
  <p>Thank you</p>