update code example in html reactivity
This commit is contained in:
parent
2f4132dc0c
commit
0f6a146c6d
1 changed files with 1 additions and 1 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue