0Pricing
Sveltejs Academy · Lesson

Creating a writable Store

Create a writable store and initialize it with a starting value.

Why Stores

Stores hold reactive state that can be shared across components. They are useful for global state like the current user.

Import writable

The writable factory comes from svelte/store.

import { writable } from "svelte/store";

All lessons in this course

  1. Creating a writable Store
  2. Subscribing with $ Auto-subscription
  3. Updating Stores: set() and update()
  4. readable Stores and Custom Start Functions
← Back to Sveltejs Academy