title: How do I cancel a `this.setState`?
body: <p>So I know that setting state in React is asynchronous and all and we set state like this:</p>
  
  <pre><code>this.setState(previousState =&gt; {
    return { /* some new state that uses `previousState` */ }
  });
  </code></pre>
  
  <p>So my question is: <strong>How can I cancel a <code>this.setState</code>?</strong> Let's say I use <code>previousState</code> to determine that I don't need to render an update. How can I cancel the <code>setState</code> and tell React not to re-render anything.</p>
  
  <pre><code>this.setState(previousState =&gt; {
    if (/* previousState is fine */) {
      // tell react not to do anything
    } else {
      return { /* some new state */ }
    }
  });
  </code></pre>