From 0f6a146c6d61f68153bf7c9e4e5f1c1915e4354b Mon Sep 17 00:00:00 2001 From: Ayo Ayco Date: Wed, 15 May 2024 20:52:23 +0200 Subject: [PATCH] update code example in html reactivity --- _posts/2023-12-21-reactive-custom-elements-with-html-dataset.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_posts/2023-12-21-reactive-custom-elements-with-html-dataset.md b/_posts/2023-12-21-reactive-custom-elements-with-html-dataset.md index a152f39..67719d2 100644 --- a/_posts/2023-12-21-reactive-custom-elements-with-html-dataset.md +++ b/_posts/2023-12-21-reactive-custom-elements-with-html-dataset.md @@ -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) {