Check out example codes for "pass dynamic javascript value to html". It will help you in understanding the concepts better.

Code Example 1

function myFunction(no) {
    if (document.getElementById("showHide"+no).style.display=="none")
    {
      document.getElementById("showHide"+no).style.display="block";
    }
    else
    {
      document.getElementById("showHide"+no).style.display="none";
    }
}

Learn ReactJs, React Native from akashmittal.com