JSFiddle - React, Tailwind, and code Playground

HTML

<div id="test">Test</div>

JavaScript

var textContent = ('textContent' in document) ? 'textContent' : 'innerText';

window.onload = function () {
    console.log(document.getElementById('test')[textContent]);
}