Check out example codes for "add an anchor tag onclick". It will help you in understanding the concepts better.

Code Example 1

<button onclick="myFunction()">Try it</button>

<script>
function myFunction() {
  var x = document.createElement("A");
  var t = document.createTextNode("Tutorials");
  x.setAttribute("href", "https://www.w3schools.com");
  x.appendChild(t);
  document.body.appendChild(x);
}
</script>

Learn ReactJs, React Native from akashmittal.com