JSFiddle - React, Tailwind, and code Playground
HTML
<date-today></date-today>
<date-today></date-today>
JavaScript
"use strict";
var _inherits = function (child, parent) {
child.prototype = Object.create(parent && parent.prototype, {
constructor: {
value: child,
enumerable: false,
writable: true,
configurable: true
}
});
if (parent) child.__proto__ = parent;
};
var DateSpan = (function () {
var _HTMLSpanElement = HTMLSpanElement;
var DateSpan = function DateSpan() {
if (_HTMLSpanElement) {
_HTMLSpanElement.apply(this, arguments);
}
};
_inherits(DateSpan, _HTMLSpanElement);
DateSpan.prototype.createdCallback = function () {
this.textContent = "Today's date: " + new Date().toJSON().slice(0, 10);
};
return DateSpan;
})();
document.registerElement("date-today", DateSpan);