title: React Native: Key Value array or hasmap?
body: <p>I would like to create an array/collection/hasmap in my react native app where a key is linked to a value. Cause I am coming from PHP I will give you a short example of what I mean. In PHP you simply create an array with key/value pair like this:</p>
  
  <pre><code>$array = array(
      41 =&gt; "bar",
      65 =&gt; "foo",
  );
  </code></pre>
  
  <p>This is what I want to have too in my react native map. A key linking to a value. Right now I am doing it like this:</p>
  
  <pre><code>var votes = [];
  
  responseJson.map((product, key) =&gt; {
    var productID = product.id;
    votes.push({
      productID: product.votes
    });
  });
  
  console.log("Votes:", votes);
  </code></pre>
  
  <p>However, what I get at the end is this:</p>
  
  <pre><code>0: {productID: "0"}
  1: {productID: "1"}
  2: {productID: "2"}
  3: {productID: "0"}
  4: {productID: "8"}
  5: {productID: "4"}
  </code></pre>
  
  <p>First of all, the productID variable gets printed as name and not as the value.. First error... And second of all I want to have something like this:</p>
  
  <pre><code>312: "0"
  521: "1"
  741: "2"
  633: "0"
  653: "8"
  873: "4"
  </code></pre>
  
  <p>You guys have any idea of how I can do this? </p>
  
  <p>Kind regards and thank you!</p>