Recall & Review
beginner
What does the $ prefix do in Svelte when used with a store variable?
The $ prefix automatically subscribes to the store and gives you the current value. It updates the value reactively when the store changes.
Click to reveal answer
beginner
How do you use the $ prefix to read a store value inside a Svelte component?
You write $storeName in your script or markup. For example, if you have a store called count, use $count to get its current value reactively.
Click to reveal answer
intermediate
Can you assign a new value to a store using the $ prefix in Svelte?
Yes! You can write $storeName = newValue to update the store's value. This automatically updates all parts of the app using that store.
Click to reveal answer
beginner
What happens if you use a store variable without the $ prefix in Svelte?
Without the $, you get the store object itself, not its value. You would need to subscribe manually to get updates.
Click to reveal answer
beginner
Why is auto-subscription with $ prefix helpful in Svelte?
It simplifies code by removing manual subscription and unsubscription. It keeps your UI in sync with store values automatically and cleanly.
Click to reveal answer
In Svelte, what does writing $count do if count is a store?
✗ Incorrect
Using $count reads the current value of the store and updates reactively when the store changes.
How do you update a writable store named 'score' using the $ prefix?
✗ Incorrect
You can assign a new value directly with $score = 10; this updates the store reactively.
What do you get if you use 'count' without $ in Svelte?
✗ Incorrect
Without $, you get the store object, not its value.
Which of these is true about auto-subscription with $ prefix?
✗ Incorrect
Svelte handles subscription and unsubscription automatically with the $ prefix.
Why is using $ prefix recommended in Svelte for stores?
✗ Incorrect
The $ prefix makes code simpler and keeps the UI in sync with store changes automatically.
Explain how the $ prefix works with stores in Svelte and why it is useful.
Think about how $storeName gives you the current value and updates automatically.
You got /5 concepts.
Describe the difference between using a store variable with and without the $ prefix in Svelte.
Consider what you get and how reactivity works in each case.
You got /4 concepts.