Recall & Review
beginner
What is a store in Svelte?
A store is a reactive object that holds state and allows components to subscribe to changes. It helps share data across many components easily.
Click to reveal answer
beginner
What is context in Svelte used for?
Context lets a parent component pass data directly to its descendants without passing props through every level. It's good for deeply nested components.
Click to reveal answer
intermediate
When should you choose stores over context in Svelte?
Use stores when you need shared state accessible by many components at different places in the app, or when state changes often and needs to be reactive.
Click to reveal answer
intermediate
When is context a better choice than stores in Svelte?
Context is better when you want to pass data only to a specific subtree of components, especially if the data is static or changes rarely.
Click to reveal answer
advanced
Can you combine context and stores in Svelte?
Yes! You can pass a store through context to limit its scope to a subtree, combining benefits of both patterns.
Click to reveal answer
What does a Svelte store provide?
✗ Incorrect
Stores hold reactive state that components can subscribe to and update.
Which Svelte feature lets a parent pass data to deeply nested children without prop drilling?
✗ Incorrect
Context allows passing data down the component tree without passing props at every level.
When should you prefer context over stores?
✗ Incorrect
Context is ideal for passing data to a limited part of the component tree.
Can stores be passed through context in Svelte?
✗ Incorrect
Passing stores via context scopes them to a subtree of components.
Which is NOT a benefit of using stores?
✗ Incorrect
Stores are for shared state, not limited to a single child.
Explain when you would use context instead of stores in a Svelte app.
Think about component hierarchy and data scope.
You got /4 concepts.
Describe how stores and context can work together in Svelte.
Consider sharing reactive data only within part of the app.
You got /4 concepts.