JSFiddle - React, Tailwind, and code Playground

by aliaksej

HTML

<textarea id="" cols="30" rows="2"></textarea>

JavaScript

function increaseRows(selector)
{
    this.setAttribute("rows", this.value.split("\n").length + 1 || 2);
}

$('textarea').on('input', increaseRows)