JSFiddle - React, Tailwind, and code Playground
by authman2
HTML
<html>
<div id='root'></div>
<script src='https://unpkg.com/@authman2/mosaic@latest/dist/index.js'></script>
<script src='./index.js'></script>
</html>
JavaScript
const Label = new Mosaic({
created: function() {
setInterval(() => this.data.count = Math.floor(Math.random() * 1000), 1000);
},
view: function() {
return html`<h1>Count: ${this.data.count || 0}</h1>`;
}
});
const app = new Mosaic({
element: '#root',
view: function() {
return html`<div>
<h1>Welcome to Mosaic</h1>
${Label.new()}
${Label.new()}
${Label.new()}
</div>`;
}
});
app.paint();