JSFiddle - React, Tailwind, and code Playground

JavaScript

var Sentence = function (text) {
    this.para = document.createElement("p");
    this.setText(text);
};

Sentence.prototype.setText = function (text) {
    if (this.node) {
        this.para.removeChild(this.node);
    }
    this.node = document.createTextNode(text);
    this.para.appendChild(this.node);
};

Sentence.prototype.getText = function () {
    if (this.node) {
        if (!this.node.textContent) {
            // typical IE hack
            return this.node.innerText;
        }
        return this.node.textContent;
    }
};

var sentence0 = new Sentence("Hello World");
document.body.appendChild(sentence0.para);
setTimeout(function () {
    sentence0.setText("I'm Edward!");
}, 5000);