Svelte · Middle · Question 46 of 75
What does export const snapshot in +page.svelte allow?
export const snapshot = {
capture: () => comment,
restore: (value) => (comment = value),
};- ✓Correct answer: Restoring ephemeral UI state (like a half-written comment) when the user goes back to the page
- 2Saving the page as an image
- 3Persisting data on the server
Explanation
The value is stored in sessionStorage, so it must be JSON-serializable and small.