JSFiddle - React, Tailwind, and code Playground
HTML
<p>
<textarea id="myWordsToCount"></textarea>
</p>
<p>
<span id ="WordCount">0</span> words
</p>
JavaScript
//"use strict";
//console.clear();
var myWordsToCount = document.getElementById("myWordsToCount");
var wordCount = document.getElementById("wordCount");
myWordsToCount.addEventListener("keyup",function(){
var words = myWordsToCount.value.split(' ');
wordCount.innerText = words.length;
});