From a9cb1ba540e70855dbe2fea30c0df4dba58f01e6 Mon Sep 17 00:00:00 2001 From: Nikola Date: Fri, 12 Feb 2021 09:54:22 +0000 Subject: [PATCH] The expression count+=1 moved to count++ In most tutorials, people use count++. Now, in the introduction video on the website, the author talks about assignment operation triggering update (the Vue example). Now, what confused me a bit, and made me try the count++ is that, it is obvious that count++ is count = count + 1 or count+=1, but since svelte is a compiler, I was not sure if the compiler, based on the expression of assignment does some work, or not. That confused me, so it is a good chance that it might confuse other people. --- .../tutorial/02-reactivity/01-reactive-assignments/text.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/site/content/tutorial/02-reactivity/01-reactive-assignments/text.md b/site/content/tutorial/02-reactivity/01-reactive-assignments/text.md index b0909f1feb..6f6afbcdad 100644 --- a/site/content/tutorial/02-reactivity/01-reactive-assignments/text.md +++ b/site/content/tutorial/02-reactivity/01-reactive-assignments/text.md @@ -14,8 +14,8 @@ Inside the `handleClick` function, all we need to do is change the value of `cou ```js function handleClick() { - count += 1; + count++; } ``` -Svelte 'instruments' this assignment with some code that tells it the DOM will need to be updated. \ No newline at end of file +Svelte 'instruments' this assignment with some code that tells it the DOM will need to be updated.