Svelte Store Guide
A complete guide to state management in Svelte using writable, readable, and derived stores for reactive data flow.
Usage
Ask about Svelte stores, custom store patterns, or reactive state management in Svelte.
Examples
- "Create a writable store with persistence to localStorage"
- "How do derived stores work in Svelte?"
- "Build a custom store with validation logic"
Guidelines
- Use writable stores for mutable shared state
- Prefer derived stores for computed values
- Always unsubscribe from stores in non-component contexts
- Use the $ prefix syntax in components for auto-subscription
- Keep stores small and focused on a single domain