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);

Explanation

The $ prefix works only in components. get is fine for occasional reads; avoid it in hot paths.

Further reading

Problem with a question

Svelte · Middle · question 65

Test yourself

Take the Svelte · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz