React - link via button with target (_blank, _self)

0 votes
358 views
added Apr 21, 2021 in React by lcjr First Warrant Officer (11,930 points)
const agentfullContact = 'tel:4013011111';
<button
  type="button"
  onClick={e => {
    e.preventDefault();
    // window.location.href='http://google.com';
    window.open(agentfullContact, '_self');
  }}
>
  Call for price
</button>

 

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...