JSFiddle - React, Tailwind, and code Playground

HTML

<div>Click a button. See the assigned value here : <span id="status"></span><br> (See what JS object is returned in console)</div>
<div id="button_out_1"></div>

CSS

button {
    height: 50px;
    width: 100px;
    margin: 10px;
}

JavaScript

// Find element in array, and return the associated data.
function findEl(array, el) {
    for(var i = 0; i < array.length; i++) {
        if(array[i][0] === el) {
            return array[i][1];
        }
    }
}
function buttonClicked(e) {
    document.getElementById("status").innerText = findEl(elem, this).b;
    // Print the object to console. Retains original object.
    console.log(findEl(elem, this));
}
        
var elem = [];
for(var i = 0; i < 16; i++) {
    var el = document.createElement("button");
    // For each created element, add the reference to an array
    // along with associated data.
    elem.push( [el, {
        a: true,
        b: i,
        c: "hello" + 3546,
        test: undefined,
        foo: null
    } ] );
    
    el.onclick = buttonClicked;
    document.getElementById("button_out_1").appendChild(el);
}