JSFiddle - React, Tailwind, and code Playground
HTML
<div class="container">
<textarea class="boring"></textarea>
<textarea class="new" id="id1"></textarea>
<textarea class="new" id="id2"></textarea>
</div>
CSS
.new {
height:20px;
}
.new:focus, .new.notEmpty {
height:80px;
}
JavaScript
$('.container').on('change', 'textarea.new', function () {
var notEmpty = $(this).val().length > 0;
$(this).toggleClass('notEmpty', notEmpty);
});