title: How to add a new key:value pair to an already existing array state variable react native
body: <p>I have a database function that returns some rows from a sqlite database then stores that in state</p>
  
  <pre><code>rows = await ReturnSelectedSymbolsDB()
  this.setState({ symbols: rows })
  </code></pre>
  
  <p>The array looks something like this</p>
  
  <pre><code>symbols: [{key: "0", symbol:"name1", active: false},{key:"1", symbol:"name2",active: false}]
  </code></pre>
  
  <p>I have another database function which returns some rows and I wish to add them to <code>symbol</code> so it would look like this. </p>
  
  <pre><code>symbols: [{key: "0", symbol:"name1", active: false, newKey: newValue},{key:"1", symbol:"name2",active: false, newKey, newValue2}]
  </code></pre>
  
  <p>The second function will return multiple rows from the database which will be easy to match up with <code>symbols</code> as symbols:symbol will match otherFunction:symbol. </p>
  
  <p>Normally you would just write this like a regular SQL query with a inner join joining the 2 tables together and then just putting the resulting rows in a state variable but I cannot in this case and must build the state variable piece by piece.</p>
  
  <p>Can this be done is regular javascript?</p>
  
  <p>EDIT:
  Probably wasnt clear but <code>newKey</code> can have different values depending on what the name of the <code>symbol</code> is</p>