title: setState in react function not updating in promise method
body: <p>Im using reactjs and know it pretty well such as the fundamentals. However, I have been doing research on this weird behavior and havent been able to find the culprit. Maybe one of you react elites have an idea lol. So I am using a stateful component that has the following state object</p>
  <pre><code>this.state = {
    buttonVisible: false,
  };
  </code></pre>
  <p>So to show the button and change the state, I am doing so in a promise</p>
  <pre><code>handleSubmit = async (e) =&gt; {
  
  const { status } = this.props;
  
       e.preventDefault();
  
  
       await verifyForm().then((data) =&gt; {
         const submissionSuccess = status === 'SUCCESSFUL_SUBMISSION';
         this.setState({
           buttonVisible: submissionSuccess
         });
         actions.showNotification(data);
       }).catch(err =&gt; actions.showNotification(err));
     };
  </code></pre>
  <p>And in the render method:</p>
  <p>This is the button that has the onClick handler that should set the buttonVisible state to true.</p>
  <pre><code>           &lt;Button
                fullWidth
                onClick={this.handleSubmit}
                type=&quot;submit&quot;
                variant=&quot;contained&quot;
                color=&quot;primary&quot;&gt;Submit 
              &lt;/Button&gt;
  </code></pre>
  <p>After I click the button with the onClick handler, it should render the following button if this.state.buttonVisible is true.</p>
  <pre><code>{ this.state.buttonVisible &amp;&amp;
                    &lt;Button
                      onClick={this.handleShowModal}
                      variant=&quot;contained&quot;
                      color=&quot;primary&quot;&gt;
                      Proceed
                    &lt;/Button&gt;
                  }
  </code></pre>
  <p>But it is not rendering the button. So I console logged the this.state.buttonVisible info and it is still false.</p>
  <p>I know that the method is not returning any error because I can see that the form is verified successfully on my end, also, it is not going to the catch block, but the .then block.
  I think it has something to do with the handleSubmit handler. But not sure what it is. Any help appreciated. Thanks!</p>