JSFiddle - React, Tailwind, and code Playground
HTML
<li class="foo">
How can I remove this text?
<ul class="bar">
<li><a href="#">Link</a></li>
</ul>
</li>
JavaScript
$('.foo').contents().filter(function(){
return (this.nodeType == 3);
}).remove();