JSFiddle - React, Tailwind, and code Playground

HTML

<textarea rows="1" cols="50"></textarea>

JavaScript

var t = document.querySelector("textarea");
t.addEventListener('input', function() {
    t.rows = (t.value.length / 50) + 1;
});