JSFiddle - React, Tailwind, and code Playground
HTML
<select id="select">
</select>
<pre id="display">
</pre>
JavaScript
var values = [];
for (var i=0; i<25000; ++i) addOption(i, 'Item' + i);
function addOption(id, name) {
var opt = document.createElement('option');
opt.value = values.length;
values.push({_id: id, name: name});
opt.appendChild(document.createTextNode(name));
select.appendChild(opt);
}
function print() {
var opt = select.selectedOptions[0];
if (opt) {
display.childNodes[0].data =
JSON.stringify(values[opt.value], null, 2);
} else {
display.childNodes[0].data = 'DESELECTED';
}
}
print();
select.addEventListener('change', print);