Skip to content

Commit 193f9e1

Browse files
authored
Merge pull request sveltejs#3955 from joncfoo/patch-1
Document $: in the tutorial
2 parents 2b0762f + ae8684f commit 193f9e1

File tree

1 file changed

+2
-2
lines changed
  • site/content/tutorial/02-reactivity/02-reactive-declarations

1 file changed

+2
-2
lines changed

site/content/tutorial/02-reactivity/02-reactive-declarations/text.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ let count = 0;
1111
$: doubled = count * 2;
1212
```
1313

14-
> Don't worry if this looks a little alien. It's valid (if unconventional) JavaScript, which Svelte interprets to mean 're-run this code whenever any of the referenced values change'. Once you get used to it, there's no going back.
14+
> Don't worry if this looks a little alien. It's [valid](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/label) (if unconventional) JavaScript, which Svelte interprets to mean 're-run this code whenever any of the referenced values change'. Once you get used to it, there's no going back.
1515
1616
Let's use `doubled` in our markup:
1717

1818
```html
1919
<p>{count} doubled is {doubled}</p>
2020
```
2121

22-
Of course, you could just write `{count * 2}` in the markup instead — you don't have to use reactive values. Reactive values become particularly valuable when you need to reference them multiple times, or you have values that depend on *other* reactive values.
22+
Of course, you could just write `{count * 2}` in the markup instead — you don't have to use reactive values. Reactive values become particularly valuable when you need to reference them multiple times, or you have values that depend on *other* reactive values.

0 commit comments

Comments
 (0)