JSFiddle - React, Tailwind, and code Playground

HTML

<script src="http://www.fakeyourbeauty.com/jquery.autosize.input.js"></script>
<textarea placeholder="Autosize" data-autosize-input='{ "space": 40 }'></textarea>

CSS

textarea {
    width: 500px;
    height:15px;
    line-height:15px;
    transition: width 0.25s;
    resize:none;
    overflow:auto;
    max-height:80px;
    min-height:45px;
}

JavaScript

$('textarea').each(function () {
  this.setAttribute('style', 'height:' + (this.scrollHeight) + 'px;overflow-y:hidden;');
}).on('input', function () {
  this.style.height = 'auto';
  this.style.height = (this.scrollHeight) + 'px';
});