Check out example codes for "boton en html cambiar texto". It will help you in understanding the concepts better.

Code Example 1

<!DOCTYPE html>
<html>
<head>
</head>

<body>

<button type="button" id="botonOn" onclick="FbotonOn()"> on </button>

</body>
</html>

<script>
var valor = true
function FbotonOn() {
  var uno = document.getElementById('botonOn');
  valor?uno.innerText = "off":uno.innerText = "on";
  valor=!valor
}

</script>

Learn ReactJs, React Native from akashmittal.com