JSFiddle - React, Tailwind, and code Playground

HTML

<button onclick="document.execCommand('bold');">B</button>
<button onclick="document.execCommand('italic');">I</button>
<div id="textarea" contenteditable></div>
<div id="textarea-show"></div>

CSS

#textarea { background-color: #fff;
    border: 1px solid #ccc;
    color: #555;
    font-size: 14px;
    height: 34px;
    width: 450px;}
    
#textarea-show{font-size: 2rem;
  color:#666;
  height:50px;
  border: 1px solid #ccc;
  width: 450px;}

JavaScript

$('#textarea').keyup(function() {
  $('#textarea-show').html($(this).text());
});