title: React clear state onClick
body: <p>I want to clear my state after onClick has been fired. However, my state doesn't update, and instead renders the initial state.</p>
  
  <p>Here is the code</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>import React from 'react';
  import {firebaseCon} from '../connection';
  
  class Update extends React.Component {
  
      constructor(props) {
          super(props);
          this.state = {
     title: ""
          };
  
          this.updateItem = this.updateItem.bind(this);
          this.handleChange = this.handleChange.bind(this);
      }
  
      componentWillReceiveProps(props) {
          this.setState({
              title: props.item.title
          });
      }
  
      updateItem(itemId) {
          let inputVal = document.getElementById("editData").value;
          firebaseCon.content.update('text', itemId, { title: inputVal })
          .then(() =&gt; console.log('Updating the entry succeeded'))
          .catch((e) =&gt; console.error(e));
          this.setState({ title: "" });
      }
  
      handleChange(e) {
          var value = e.target.value;
          this.setState({ title: value });
      }
  
      render() {
          return (
              &lt;div className="input-field col s12"&gt;
                  &lt;i className="material-icons prefix"&gt;mode_edit&lt;/i&gt;
                  &lt;input type="text" id="editData" value={this.state.title || ""} onChange={this.handleChange} /&gt;
                  &lt;button className="waves-effect waves-light btn" onClick={this.updateItem.bind(this, this.props.item.id)}&gt;UPDATE&lt;/button&gt;
              &lt;/div&gt;
          )
      }
  }
  
  export default Update</code></pre>
  </div>
  </div>
  </p>
  
  <p>I have a button in another component, that sets the props when clicked and my inputfield then use this as value. When changing the value, the state updates, which is working fine. However, when I then click my update button, the data is correctly updated, but the state is not updated.</p>