JSFiddle - React, Tailwind, and code Playground

JavaScript

var _timeOut = null;

var form = function () {
    var pub = {}, timeout;

function textareaAutoGrow() {
    alert('=)');
    var pad = $(this).outerHeight(false) - $(this).innerHeight();

    this.style.height = "auto";
    this.style.height = (this.scrollHeight + pad) + "px";
}

function textareaResize() {
    alert("resize");
    
    if(typeof(_timeOut))
       clearTimeout(_timeOut);
    _timeOut = setTimeout(function () {
        textareaAutoGrow();
    }, 300);
}

    $("body").on("input", "textarea", textareaAutoGrow);
    $(window).on("resize", textareaResize);

return pub;
} ();