JSFiddle - React, Tailwind, and code Playground

JavaScript

function throttle(delay, callback) {
    var previousCall = new Date().getTime();
    return function() {
        var time = new Date().getTime();
        if ((time - previousCall) >= delay) {
            previousCall = time;
            callback.apply(this, arguments);
        }
    };
}

$(window).resize(throttle(200, callFunc));


function callFunc(){
    console.log("hi");
}