JSFiddle - React, Tailwind, and code Playground
by jorgeluis
HTML
One way to store an html tree in a variable is to use an array, with each line representing a line of html. It's easy to read.
Then insert it in the DOM with join('')
JavaScript
var chunk = [
'<div class="container">',
'<h2>Chunk of html to add</h2>',
'<p>An array with .join looks like an elegant solution</p>',
'</div>'
];
alert(chunk.join(''));