0Pricing
Sveltejs Academy · Lesson

When to Use Stores vs Local State

Choose between component state and stores based on sharing and lifetime needs.

Local State

Use let in a component when the data belongs only to that component.

Component Props

Use export let for inputs from a parent. The parent owns the state.

All lessons in this course

  1. Reactive Statements: $: block
  2. Reactive Dependencies and Ordering
  3. When to Use Stores vs Local State
  4. Avoiding Stale Closures
← Back to Sveltejs Academy