title: reactjs How to pass a variable to a function inside setState
body: <p>I create a method inside ReactJS class called addTotal(price). Now I have to pass a variable to a function inside setState(), but it does not work:</p>
  
  <pre><code>    addTotal(price){
          this.setState(function(prevState, props, price) {
              return {total: this.state.total + price};
          });     
      }
  </code></pre>