State management solution for Svelte using proxies. Powered by valtio.
pnpm add valtio sveltio
// store.ts
import { proxy } from 'sveltio'
export const state = proxy({ count: 0 })
Read from snapshots, mutate the source.
<script lang="ts">
import { useSnapshot } from 'sveltio'
import { state } from './store'
const snap = useSnapshot(state)
</script>
<button on:click={() => state.count++}>
Clicks: {$snap.count}
</button>
For more info on how to use valtio
, check out the official docs.
MIT