JSFiddle - React, Tailwind, and code Playground

HTML

<div id="hold-this"></div

JavaScript

var container = document.getElementById("hold-this"),
    obj = {
        text: "beh"
    };

function myFunction(obj) {
    var el = document.createElement("div"),
        button = document.createElement("button");

    button.innerHTML = "Click to change to beh";
    button.onclick = function( e ) {
        listener(e, obj);
    }
        
    el.appendChild(button);
    container.appendChild(el);
}

function listener(e, obj) {
    e.target.innerHTML = obj.text;
}

myFunction(obj)