title: setState(): Do not mutate state directly. Use setState()
body: <p>I get the following warning when I run the code:</p>
  
  <blockquote>
    <p>Line 48:  Do not mutate state directly. Use setState() 
    react/no-direct-mutation-state</p>
  </blockquote>
  
  <p>This warning refers to these lines of code:</p>
  
  <pre><code>updateDelay(prediction_arr,prediction_dep) {
    this.state.chartDataWake = [...this.state.chartDataWake, {wake: this.state.wake===84.73 ? "H" : (this.state.wake===14.78 ? "M" : "L"), delay: prediction_arr}];
    this.state.chartDataTurnaround = [...this.state.chartDataTurnaround, {turnaround: this.state.schedTurnd, delay: prediction_arr}];
  
    this.setState({
      prediction_arr: prediction_arr,
      prediction_dep: prediction_dep,
      delay_arr_cat: prediction_arr===0 ? "&lt;15" : (prediction_arr===1 ? "[15; 45]" : "&gt;45")
    });
  };
  </code></pre>
  
  <p>I understand that I should put all declarations inside <code>this.setState({</code>. However it is not clear to me how exactly should I change</p>
  
  <pre><code>this.state.chartDataTurnaround = [...this.state.chartDataTurnaround, {turnaround: this.state.schedTurnd, delay: prediction_arr}];
  </code></pre>
  
  <p>in order to be able to compile the code.</p>