title: How to execute onclick before navigating to a different page?
body: <p>I am working in React and I have the following scenario. </p>
  
  <pre><code>  &lt;a href={link} variant="primary" onClick={this.onClickDoSomething}&gt;
                            here.
    &lt;/a&gt;
  </code></pre>
  
  <p>Now, I want the onclick to execute before the link has been clicked. However I do not see it happening. </p>
  
  <p>How to work around this issue ? Thanks.</p>