You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/packages/svelte/tests/runtime-runes/samples/toStore-subscribe2/main.svelte

12 lines
270 B

<script>
import { toStore } from "svelte/store";
let counter = $state(0);
const count = toStore(() => counter, value => counter = value);
</script>
<div>Count {counter}!</div>
<div>Count from store {$count}!</div>
<button onclick={() => counter+=1}>Add 1</button>