You don't even need jQuery nor React to do that. It's as simple as this:
var ex = document.getElementById('ex');
ex.onclick = function(){
console.log('clicked');
}
var bt = document.getElementById('bt');
bt.onclick = function(){
ex.click();
}
<button id="bt">Click</button>
<a id="ex">Triggerable link</a>
Of course, in React you can store the ref
of the components, bind to the event and then trigger the event like this:
onClick(){
this.ex.click();
}
render(){
return (
<div>
<button id="bt" onClick={this.onClick.bind(this)} ref={(ref)=>{this.bt = ref}}>Click</button>
<a id="ex" onClick={()=>console.log("clicked")} ref={(ref)=>{this.ex = ref}}>Triggerable link</a>
</div>
)
}
Edit: If you just want a button that behaves like a link, you can use this, or any of the solutions listed in this question:
onClick(){
window.location.href="http://url.com";
}
render(){
return (
<button id="bt" onClick={this.onClick}>Click</button>
)
}