JSFiddle - React, Tailwind, and code Playground

HTML

<div id="clicker"></div>

CSS

#clicker {
    width: 50px;
    height: 50px;
    margin: 20px;
    
    background: orange;
    color: #fff;
    font-size: 24px;
    font-weight: bold;
    font-family: Arial, sans-serif;
}

JavaScript

var timeout, clicker = $('#clicker');
var count = 0;

clicker.mousedown(function(){
    timeout = setInterval(function(){
        clicker.text(count++);
    }, 500);

    return false;
});

$(document).mouseup(function(){
    clearInterval(timeout);
    return false;
});