mirror of https://github.com/sveltejs/svelte
parent
9c8e643b64
commit
151cdeacaf
@ -1,18 +1,14 @@
|
||||
<script>
|
||||
import { untrack } from 'svelte';
|
||||
import { writable } from 'svelte/store';
|
||||
import { log } from './log';
|
||||
|
||||
const storeCount = writable(0)
|
||||
let count = $state(0);
|
||||
const count = writable(0);
|
||||
let ran = 0;
|
||||
|
||||
$effect(() => {
|
||||
$storeCount;
|
||||
untrack(() => {
|
||||
count++;
|
||||
log.push(count);
|
||||
});
|
||||
$count;
|
||||
log.push(++ran);
|
||||
});
|
||||
</script>
|
||||
|
||||
<button on:click={() => $storeCount++}>increment</button>
|
||||
<button on:click={() => $count++}>increment</button>
|
||||
|
Loading…
Reference in new issue