Docs: Accurately name function (#4060)

pull/6456/head
The Jared Wilcurt 3 years ago committed by GitHub
parent f99deeb67b
commit 7115601cd3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,11 +1,11 @@
<script>
let count = 0;
function handleClick() {
function incrementCount() {
count += 1;
}
</script>
<button on:click={handleClick}>
<button on:click={incrementCount}>
Clicked {count} {count === 1 ? 'time' : 'times'}
</button>
</button>

@ -7,15 +7,15 @@ At the heart of Svelte is a powerful system of *reactivity* for keeping the DOM
To demonstrate it, we first need to wire up an event handler. Replace line 9 with this:
```html
<button on:click={handleClick}>
<button on:click={incrementCount}>
```
Inside the `handleClick` function, all we need to do is change the value of `count`:
Inside the `incrementCount` function, all we need to do is change the value of `count`:
```js
function handleClick() {
function incrementCount() {
count += 1;
}
```
Svelte 'instruments' this assignment with some code that tells it the DOM will need to be updated.
Svelte 'instruments' this assignment with some code that tells it the DOM will need to be updated.

Loading…
Cancel
Save