title: ReactJS setState multidimensional array variable keys in sub array
body: <p>I have an array of components which each have component details and I'm trying to update a detail for a component. </p>
  
  <p>I know I can do this</p>
  
  <pre><code>this.setState({
      component: {
         ...this.state.component,
         [var]: value
      }
  });
  </code></pre>
  
  <p>but I need to be able to do this</p>
  
  <pre><code>this.setState({
      component[key]: {
         ...this.state.component[key],
         [key2]: value
      }
  });
  </code></pre>
  
  <p>which fails. How can I modify a sub array without modifying state and replacing the whole thing? </p>