Svelte · Junior · Question 45 of 76
How do you share reactive state between components without stores in Svelte 5?
// counter.svelte.js
export const counter = $state({ value: 0 });- ✓Correct answer: Declare
$statein a.svelte.jsmodule and export an object whose properties you mutate - 2Export a plain
letfrom a.jsfile - 3It is impossible without stores
Explanation
Exporting a reassigned primitive (export let count = $state(0)) doesn't work, because importers get a value, not a live binding; mutate an object or export getter functions.