JSFiddle - React, Tailwind, and code Playground
HTML
<textarea name="" id="texto" cols="30" rows="10"></textarea>
CSS
textearea {
resize: none;
/* impede que o próprio usuário altere o tamanho do textarea */
width:300px;
height:100px;
overflow-y: auto;
}
JavaScript
$('#texto').on('keyup onpaste', function () {
var alturaScroll = this.scrollHeight;
var alturaCaixa = $(this).height();
if (alturaScroll > (alturaCaixa + 10)) {
if (alturaScroll > 500) return;
$(this).css('height', alturaScroll);
}
});