JSFiddle - React, Tailwind, and code Playground

HTML

<body>
<button id="testBtn">Test</button>
</body>

JavaScript

function TestUIElem() {
    this.elem = null;
    this.onClick = this.onClick.bind(this);
}
TestUIElem.prototype.activate = function () {
    this.elem = document.querySelector('button#testBtn');
    this.elem.addEventListener('click', this.onClick, false);
};
TestUIElem.prototype.onClick = function () {
    alert('test');
    this.deactivate();
};
TestUIElem.prototype.deactivate = function () {
    this.elem.removeEventListener('click', this.onClick);
};

testUIElem = new TestUIElem();
testUIElem.activate();