title: Is there a synchronous alternative of setState() in Reactjs functional components
body: <p>I know how to do this in class components but when i use same code in functional component i get an error. This is what i want - </p>
  
  <pre><code>this.setState({cnt:this.state.cnt+1})
  alert(this.state.cnt);
  </code></pre>
  
  <p>now i want the alert to show count as 1 . 
  How we do it in class component - </p>
  
  <p><code>this.setState({cnt:this.state.cnt+1}, () =&gt; alert(this.state.cnt));</code></p>
  
  <p>But when i do same in functional component like this </p>
  
  <pre><code>const[count, setCount] = useState(0);
  setCount(count+1, () =&gt; alert(count));
  </code></pre>
  
  <p>I get an error - "expected no of arguments - 1".</p>