summaryrefslogtreecommitdiff
path: root/examples/with-svelte/src/components/Counter.svelte
blob: 9aaf421c1a9578381186f83b849e8f746d76f4ad (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<script>
  let count = 0;

  function add() {
    count += 1;
  }

  function subtract() {
    count -= 1;
  }
</script>

<div class="counter">
  <button on:click={subtract}>-</button>
  <pre>{ count }</pre>
  <button on:click={add}>+</button>
</div>
<div class="children">
  <slot />
</div>