JSFiddle - React, Tailwind, and code Playground

HTML

<textarea>Hello</textarea>

JavaScript

$('textarea').keyup(function(e) {
    var code = (e.keyCode ? e.keyCode : e.which);
    if (code==13) {
      $(this).attr('rows', $(this).val().split("\n").length + 1);
    }
});