Change from "store name" to "store variable"

pull/2720/head
Artur Carvalho 6 years ago committed by GitHub
parent 3d9cb3b611
commit 341e41a653
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -26,7 +26,7 @@ One way to fix it would be to use the `onDestroy` [lifecycle hook](tutorial/onde
<h1>The count is {count_value}</h1> <h1>The count is {count_value}</h1>
``` ```
It starts to get a bit boilerplatey though, especially if your component subscribes to multiple stores. Instead, Svelte has a trick up its sleeve — you can reference a store value by prefixing the store name with `$`: It starts to get a bit boilerplatey though, especially if your component subscribes to multiple stores. Instead, Svelte has a trick up its sleeve — you can reference a store value by prefixing the store variable with `$`:
```html ```html
<script> <script>
@ -43,4 +43,4 @@ It starts to get a bit boilerplatey though, especially if your component subscri
You're not limited to using `$count` inside the markup, either — you can use it anywhere in the `<script>` as well, such as in event handlers or reactive declarations. You're not limited to using `$count` inside the markup, either — you can use it anywhere in the `<script>` as well, such as in event handlers or reactive declarations.
> Any name beginning with `$` is assumed to refer to a store value. It's effectively a reserved character — Svelte will prevent you from declaring your own variables with a `$` prefix. > Any name beginning with `$` is assumed to refer to a store value. It's effectively a reserved character — Svelte will prevent you from declaring your own variables with a `$` prefix.

Loading…
Cancel
Save