```
### 13. App State
**Before:**
```svelte
import {page} from '$app/stores'
```
**After:**
```svelte
import {page} from '$app/state'
```
## Workflow
1. Read the file to understand its current structure
2. Identify all Svelte 4 patterns that need migration
3. Apply transformations systematically:
- Props first (export let → $props)
- State variables (let → $state where needed)
- Derived values ($: assignments → $derived)
- Side effects ($: statements → $effect)
- Event handlers (on: → on)
- Component events (dispatch → callback props)
- Slots (slot → snippets)
4. Update imports (add Snippet type if needed, remove createEventDispatcher if no longer used)
5. Ensure TypeScript types are correct
6. Run `pnpm check` to verify no type errors
## Important Notes
- Keep `onMount` and `onDestroy` - they're still valid
- `context="module"` scripts are now `