I have to append list of cards to dom.
html
<div class="card">
<div class="card-title">Card 1</div>
<div class="card-subtext">This is card 1</div>
</div>
js
let htmlString = '';
for(let i = 0 ; i < arr.length ; i ++){
htmlString += `<div class="card">
<div class="card-title">${arr[idx].title}</div>
<div class="card-subtext">${arr[idx].text}</div>
</div>`;
}
document.getElementByID('card-container').innerHTML = htmlString;
where arr is an array of card objects.
It is a good practice to do it this way? (Please note I don't want to use template library).
Or should I use document fragments to achieve the same? If yes, how would it improve the performance?