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: 200px;
    height:15px;
    line-height:15px;
    min-width: 200px;
    max-width: 300px;
    transition: width 0.25s;
    resize:none;
    overflow:hidden;
}

JavaScript

$('textarea').on('keydown', function(e){
    if(e.which == 13) {e.preventDefault();}
}).on('input', function(){
    $(this).height(1);
    var totalHeight = $(this).prop('scrollHeight') - parseInt($(this).css('padding-top')) - parseInt($(this).css('padding-bottom'));
    $(this).height(totalHeight);
});