title: setState update array value using index in react
body: <p>I want to update array value using index, is below code ok?</p>
  
  <pre><code>handleChange = index =&gt; e =&gt; {
    const { rocket } = this.state // ['tesla', 'apple', 'google']
    rocket[index] = e.target.value
    this.setState({ rocket })
  }
  </code></pre>
  
  <p>my jsx</p>
  
  <pre><code>&lt;div&gt;{rocket.map((val,i) =&gt; &lt;input type="text" onChange={handleChange(i)} value={val} /&gt;)}&lt;/div&gt;
  </code></pre>
  
  <p>I know it worked, but just to be sure it's ok to mutate the state like that. </p>