stores svelte code example
Example: store svelte
import { writable } from 'svelte/store';
export const count = writable(0);
function increment() {
count.update(n => n + 1);
}
function reset() {
count.set(0);
}
// in other svelte component
let count_value;
const unsubscribe = count.subscribe(value => {
count_value = value;
});