Programming Tips - Minimal web component

Date: 2020jul17 Updated: 2024mar23 Language: javaScript Q. Minimal web component A. There are dozens of counters: http://www.google.com/search?q=web+component+counter Its a useful example because it has to retain some state. Usage:
<script src='js/counter.js'></script> <my-counter></my-counter>
Oddly, they need to have a dash in the name. Self-closing syntax like <my-counter/> does NOT work. More discussion: https://news.ycombinator.com/item?id=23871367