2019-03-10 14:30:29 +01:00
---
title: Assignments
---
2023-04-02 17:24:33 +02:00
At the heart of Svelte is a powerful system of _reactivity_ for keeping the DOM in sync with your application state — for example, in response to an event.
2019-03-10 14:30:29 +01:00
To demonstrate it, we first need to wire up an event handler. Replace line 9 with this:
2023-04-02 17:24:33 +02:00
```svelte
2021-06-26 20:23:30 +02:00
< button on:click = {incrementCount} >
2019-03-10 14:30:29 +01:00
```
2021-06-26 20:23:30 +02:00
Inside the `incrementCount` function, all we need to do is change the value of `count` :
2019-03-10 14:30:29 +01:00
```js
2021-06-26 20:23:30 +02:00
function incrementCount() {
2019-03-10 14:30:29 +01:00
count += 1;
}
```
2021-06-26 20:23:30 +02:00
Svelte 'instruments' this assignment with some code that tells it the DOM will need to be updated.