title: Add new Key/Value into Object in React Native
body: <p>I'm working on a React Native project. Right now, I'm adding new key/value inside an object.</p>
  
  <p>It's working but I would like to know if there is a better way to do it or if you have any advice.</p>
  
  <p>I'm still new to ReactJS/React Native and not 100% skills on Javascript. So here's my code :</p>
  
  <p><strong>My object</strong></p>
  
  <pre><code>state = {
      result : {
          "q1":1
      }
  }
  </code></pre>
  
  <p><strong>My function</strong> to add key/value and modify the state of <code>result</code> :</p>
  
  <pre><code>_getValue = (id, value) =&gt; {
  
      var newObj = this.state.result;
          newObj[id] = parseInt(value);
  
      this.setState({
          result: newObj
      }, () =&gt; {
          console.log(this.state.result)
      })
  }
  </code></pre>
  
  <p>Thank you !</p>