title: Get undefined in click function
body: <p>I use react js for my application.
  I have a function which is called when I click on the button.</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>const click = () =&gt; {
    dispatch(postData)
    console.log(selector.createUser.error.message;)
  }</code></pre>
  </div>
  </div>
  </p>
  <p>When I click on button submit i want to get the error message in <code>console.log(selector.createUser.error.message;)</code> , but i get undefined, and if i click second time i get the message. <br>
  Why it is happening and ho to solve? How to get the exact value in click function clicking first time?</p>