|
|
@ -7,13 +7,13 @@ 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:
|
|
|
|
To demonstrate it, we first need to wire up an event handler. Replace line 9 with this:
|
|
|
|
|
|
|
|
|
|
|
|
```html
|
|
|
|
```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 `handleClick` function, all we need to do is change the value of `count`:
|
|
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
```js
|
|
|
|
function handleClick() {
|
|
|
|
function incrementCount() {
|
|
|
|
count += 1;
|
|
|
|
count += 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
```
|
|
|
|