Skip to content

Instantly share code, notes, and snippets.

@camilomontoyau
Created November 12, 2018 04:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save camilomontoyau/c2af00396213dd25f10ccac11514db92 to your computer and use it in GitHub Desktop.
Save camilomontoyau/c2af00396213dd25f10ccac11514db92 to your computer and use it in GitHub Desktop.
react es JS
<html>
<body>
<div>
<div>PROP: <span>hola soy un texto estático</span></div>
<div>ESTADO: <span id="clicks">0</span></div>
<button id="boton">click acá</button>
</div>
<script type="text/javascript">
const clicksElement = document.getElementById('clicks');
const boton = document.getElementById('boton');
console.log(clicksElement);
function cambiarClicks() {
let numeroClicks = parseInt(clicksElement.innerText);
console.log('numeroClicks', numeroClicks);
numeroClicks++;
clicksElement.innerText = numeroClicks.toString();
}
boton.onclick = cambiarClicks;
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment