title: How to update an array at a particular index with React js
body: <p>I have a state array in my constructor:</p>
  
  <pre><code>constructor(props) {
     super(props);
     this.state = {myarray: []};
  }
  </code></pre>
  
  <p>Now I want to update the array at a specific subscript.</p>
  
  <pre><code>this.setState({myarray[i]: 'test'});
  </code></pre>
  
  <p>gives me an <code>unexpected token</code> error, pointing at the opening bracket <code>[</code></p>
  
  <p>What is the correct way of doing that?</p>
  
  <p>P.S. Array gets filled dynamically using <code>push</code> method and only then I attempt to update</p>