JSFiddle - React, Tailwind, and code Playground
HTML
<div class="target">something</div>
JavaScript
function getRandom(){
return (Math.floor(Math.random() * (200 - 100 + 1)) + 100).toString();
}
var attrs = {};
attrs["data-" + getRandom()] = "something";
attrs["data-" + getRandom()] = "something";
attrs["data-" + getRandom()] = "something";
//console.log(attrs);
$(".target").attr(attrs);