title: react set state callback correct way to pass an argument
body: <p>I am using React's <code>setState</code> method, and calling another function when the state has been updated.</p>
  
  <p>Is there a preferred approach as to how to call the function that is passed to <code>setState</code> as a callback.</p>
  
  <p>Both of the approaches below work but is there any performance implications of using one over the other?</p>
  
  <pre><code>  this.setState(prevState =&gt; {
      return {
        result: '1-0'
      }
    }, this.clearResult(500))
  </code></pre>
  
  <p>or </p>
  
  <pre><code>  this.setState(prevState =&gt; {
      return {
        result: '1-1',
  
      }
    }, () =&gt; this.clearResult(500))
  </code></pre>
  
  <p>My <code>clearPin</code> method looks like the following. All of this code is within a React component.</p>
  
  <pre><code>  clearResult(time) {
  
      setTimeout(() =&gt; {
        this.setState({
          result: '0-0'
        })
      }, time)
  
    }
  </code></pre>