JSFiddle - React, Tailwind, and code Playground
HTML
<button name="start">Start</button>
<button name="end">End</button>
<div></div>
JavaScript
var myInterval;
$('button[name="start"]').click(function(){
myInterval = setInterval(function(){
$('body div').prepend('Oh Hai! ');
},1000);
});
$('button[name="end"]').click(function(){
clearInterval(myInterval);
});