JSFiddle - React, Tailwind, and code Playground

HTML

<button id="jBold"><b>B</b></button>
<div id='fake_textarea' contenteditable>
Select some text and click the button to make it bold...
<br>Or write your own text
</div>

CSS

#fake_textarea {
  width: 100%;
  height: 200px;
  border: 1px solid red;
}
button{
  font-weigth:bold;
}

JavaScript

$(document).ready(function() {
  $('#jBold').click(function() {
    document.execCommand('bold');
  });
});