A Simple Component with JSX gzip 1.34 kB

This example uses JSX as the template language which is also supported if you prefer that over tagged templates.

const HelloMessage = ({ name }) => (
<>
<div>Hello {name}</div>
<div>How are you?</div>
</>
);

document.querySelector('.hello-example').append(
<HelloMessage name="World" />
);