Svelte · Middle · Question 49 of 75
Why isn't count reactive in the importing component?
// counter.svelte.js
export let count = $state(0);
export function increment() { count += 1; }- ✓Correct answer: You can't export state that is reassigned; the compiler only rewrites access inside the module. Export an object or getter instead
- 2
.svelte.jsfiles don't support runes - 3
incrementmust be async
Explanation
Svelte reports a compile error for this pattern. export const counter = $state({ count: 0 }) works because you mutate a property.