JSFiddle - React, Tailwind, and code Playground

by Vladymyr Shevchuk

HTML

<div id="root"></div>

JavaScript

function Component () {
  // click h1 => Some text
 return `
    <div class='main'>
      <h1 id='innerText'>Some text</h1>
    </div>
 `;
};

let el = getElementById('root').append(Component()); // [object Object]


let innerText = getElementById('innerText')

innerText.addEventListener('click', event => {
  console.log(event.target.innerText);
});

// <div id="root"></div>

// <div class="main">
//  <h1>Hey, my name is Component</h1>
// </div>