JSFiddle - React, Tailwind, and code Playground
HTML
<textarea id='text'></textarea>
<p>
Words amount: <div id='textInfo'></div>
</p>
JavaScript
var textArea = $('#text');
var textAreaInfo = $('#textInfo');
function countWords(){
textAreaInfo.html(textArea.val().split(/\S+/g).length-1);
}
textArea.keyup(function(){
countWords();
});