JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://unpkg.com/radi@0.1.8/dist/radi.js"></script>
JavaScript
const { r, l, mount, component } = radi;
const counter = component({
view: function() {
return (
r('button', {onclick: this.up, id: l(this.counter)}, 'Click me ', l(this.counter))
)
},
state: {
counter: 0
},
actions: {
up() {
this.counter += 1;
setTimeout(() => {
alert(document.getElementById('1') === input ? 'Same DOM element' : 'Different DOM element')
}, 100)
},
}
});
mount(new counter(), document.body);
const input = document.getElementById('0');