In React, how can I cause anchors to do nothing on click?

I have the following html element:

<a href onClick={() => fields.push()}>Add Email</a>

I need the href attribute so bootstrap styles the element with a link styling (color, cursor).

Problem is, if I click that now it causes the browser to redirect. How can I update the above to not redirect the browser onClick but still run fields.push()?

157 thoughts on “In React, how can I cause anchors to do nothing on click?”

  1. You could certainly see your expertise in the work you write.
    The sector hopes for even more passionate writers like you who are not afraid to say how they believe.

    All the time go after your heart.

    Reply
  2. Excellent weblog right here! Additionally your site loads up fast!
    What host are you using? Can I get your associate hyperlink to your host?

    I want my site loaded up as quickly as yours lol

    Reply
  3. Hey I am so grateful I found your site, I really found you by accident, while I was
    looking on Google for something else, Regardless I am here now and would just like to say thanks a lot for
    a marvelous post and a all round thrilling blog (I also love the theme/design), I don’t have time to read it all at the minute but I have book-marked it and also included your RSS feeds,
    so when I have time I will be back to read a lot more, Please do keep up the superb work.

    Reply
  4. Greetings from Idaho! I’m bored to death at work so I decided to check out your site on my iphone during lunch break.
    I really like the knowledge you present here and can’t wait to take
    a look when I get home. I’m amazed at how quick your blog loaded on my
    cell phone .. I’m not even using WIFI, just 3G ..
    Anyhow, amazing site!

    Reply
  5. I will right away take hold of your rss feed as I can’t in finding your email subscription link or e-newsletter service.
    Do you have any? Kindly allow me know in order that I may just subscribe.

    Thanks.

    Reply

Leave a Comment