title: reactjs: call a function after setState used with prevState
body: <p>I am trying to call a function after my state is changed. </p>
  
  <p>The following is the code. Its not working</p>
  
  <pre><code>    this.setState(prevState =&gt; (
              {
                  test: "sample"
              },() =&gt; {
                      console.log("after statechanges")
              }
          ));
  </code></pre>
  
  <p>whereas the below works, but i want to use the prevstate.</p>
  
  <pre><code>this.setState(
          {
              test: "sample"
          },() =&gt; {
                  console.log("after statechanges")
          }
      );
  </code></pre>