title: How to use setState() in React to blank/clear the value of an array
body: <p>I am trying to clear an array, but I'm having trouble. 
  <code>this.setState({warnErrorTypes:[]})</code></p>
  
  <p>I'm not sure if I am dealing with a race condition, or what the specific issue is, but I can see that the value of my array is consistently wrong in the case that I need to reset its value to [].</p>
  
  <p>How does one replace an array that contains [1,2] with [] then subsequently [3] where the following are true:</p>
  
  <ol>
  <li>this.state.warnErrorTypes is an Array which starts out with []</li>
  <li>Based on condition, 2 is pushed in Array</li>
  <li>Based on condition, 1 is pushed in Array.</li>
  <li>Based on condition, 3 is NOT pushed in Array</li>
  <li>Pause. User interacts with UI</li>
  <li>Array is blanked: <code>this.setState({warnErrorTypes:[]})</code></li>
  <li>Based on condition, 2 is NOT pushed in Array</li>
  <li>Based on condition, 1 is NOT pushed in Array</li>
  <li>Based on condition, 3 is pushed in Array.</li>
  </ol>
  
  <p>The result of the logic above is always <code>[2,1,3]</code>, when I expect it to be <code>[3]</code>.</p>