aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/Counter.svelte
blob: e4175052e1484ec3721977be0ca3258c1b0e2b09 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
<script>
  import { getStore } from './hmr-stores';
  export let id;
  const count = getStore(id, 0);
  export const increment = () => {
    $count += 1
  };
</script>

<button class="px-8 py-4 w-52 text-red-500 bg-red-200 rounded-full" {id} on:click={increment}>
  Clicks: {$count}
</button>