title: React.Component setState atomic updates
body: <p><a href="https://facebook.github.io/react/docs/react-component.html#setstate" rel="nofollow noreferrer">https://facebook.github.io/react/docs/react-component.html#setstate</a></p>
  
  <blockquote>
    <p>It's also possible to pass a function with the signature
    function(state, props) => newState. This enqueues an atomic update
    that consults the previous value of state and props before setting any
    values. For instance, suppose we wanted to increment a value in state
    by props.step:</p>
  </blockquote>
  
  <pre><code>this.setState((prevState, props) =&gt; {
    return {myInteger: prevState.myInteger + props.step};
  });
  </code></pre>
  
  <p>What is meant by atomic update here? Isn't JavaScript a single threaded language? Which means that all the updates are bound to be atomic?</p>