JSFiddle - React, Tailwind, and code Playground
HTML
<button id="start">start</button>
<button id="stop">stop</button>
JavaScript
var funky = setInterval(function() {
alert('hello world');
}, 2000);
$('#start').click(function() {
funky();
});
$('#stop').click(function() {
clearInterval(funky);
});