JSFiddle - React, Tailwind, and code Playground

by tonyleeper

HTML

<div class="target"></div>

JavaScript

'use strict';

const HELLO_WORLD = 'Hello world';
console.log(HELLO_WORLD);

let numbers = [1, 2, 3];
numbers.forEach(number => console.log(number));

class MyControl {
	constructor(element, spec) {
    	this.element = element;
        this.update(spec);
    }
    
    render() {
    	this.element.innerHTML = `hello ${this.spec.name}`;
    }
    
    update(spec) {
        this.spec = spec;
        this.render();
    }
    
    dispose() {
    }
}

let target = document.createElement('MyControl');
let control = new MyControl(target, { name: 'Tony' });
document.body.appendChild(target);