title: How do I add a delay on a button click in react?
body: <p>I'm attempting to delay a button click so that the library I'm using can make a quick api call for validation. I'm currently using an arrow function in react and attempting setTimeout. However it appears this is triggering a call on page load for some reason. Here's my code. </p>
  
  <pre><code>  onClick={this.handleCardSubmit}
  
  handleCardSubmit = setTimeout(() =&gt; {
      this.setState({ showLoaderForPayment: true });
      const { collectJs } = this.state;
      collectJs.startPaymentRequest();
      this.setState({ isPaymentRequestCalled: true });
    }, 500);
  </code></pre>