Svelte · Middle · Question 46 of 75

What does export const snapshot in +page.svelte allow?

export const snapshot = {
  capture: () => comment,
  restore: (value) => (comment = value),
};

Explanation

The value is stored in sessionStorage, so it must be JSON-serializable and small.

Further reading

Problem with a question

Svelte · Middle · question 46

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