JSFiddle - React, Tailwind, and code Playground
HTML
<textarea autofocus></textarea>
CSS
textarea {
width: 400px;
height: 200px;
}
JavaScript
document.querySelector('textarea').onkeydown = function (e) {
if (e.which === 13) { // on enter
document.execCommand('insertText', false, 'ENTER');
}
};