Svelte · Middle · Question 65 of 75
How do you read a store's current value once, outside a component?
import { get } from "svelte/store";
const value = get(count);- ✓Correct answer: With
get(store), which subscribes, reads and unsubscribes - 2With
$countin a.jsfile - 3With
count.value
Explanation
The $ prefix works only in components. get is fine for occasional reads; avoid it in hot paths.