JSFiddle - React, Tailwind, and code Playground
by daker
HTML
<template id="commentTemplate">
<div>
<img src="">
<div class="comment-text"></div>
</div>
</template>
JavaScript
function addComment(imageUrl, text) {
var t = document.querySelector("#commentTemplate"),
comment = t.content.cloneNode(true);
comment.querySelector('img').src = imageUrl;
comment.querySelector('.comment-text').textContent = text;
document.body.appendChild(comment);
}
addComment("http://daker.me/assets/images/avatar.png", "This is a test comment");
addComment("http://daker.me/assets/images/avatar.png", "It working...");