update code example in html reactivity

This commit is contained in:
Ayo Ayco 2024-05-15 20:52:23 +02:00
parent 2f4132dc0c
commit 0f6a146c6d

View file

@ -39,7 +39,7 @@ Let's consider the following code example (also [in CodePen →](https://code
class Counter extends HTMLElement {
static observedAttributes = ["data-count"];
connectedCallback() {
this.dataset.count = 0;
this.dataset.count = this.dataset.count ?? 0;
this.onclick = () => ++this.dataset.count;
}
attributeChangedCallback(prop, oldValue, newValue) {