JSFiddle - React, Tailwind, and code Playground

HTML

<textarea></textarea>

CSS

textarea {
    resize: none; /* impede que o próprio usuário altere o tamanho do textarea */
    width:300px;
    height:100px;
    overflow-y: auto;
}

JavaScript

$("textarea").bind("input", function(e) {
    while($(this).outerHeight() < this.scrollHeight + parseFloat($(this).css("borderTopWidth")) + parseFloat($(this).css("borderBottomWidth")) &&
          $(this).height() < 500
         ) {
        $(this).height($(this).height()+1);
    };
});