store.js
import {writable} from "svelte/store"
export const apple = writable(5)
Get store
<p>I have {$apple} apples</p>
<script>
import {apple} from "./store.js"
</script>
Change store
import {apple} from "./store.js"
$apple = 10
or
import {apple} from "./store.js"
$apple = $apple + 1
Top comments (0)