Well done on finishing Saving State in the Browser.
In this course, you learned how to:
- Loop over objects and follow paths into nested data
- Save data as JSON text in
localStorageand load it on every visit - Catch a damaged save and upgrade old saves with a version number
- Make an app remember its data across reloads, and keep working when the saved data is missing, corrupt, or in an older shape
In the video, Sam’s finished box loads each kind of save:
| Save in storage | What Sam’s box shows |
|---|---|
| None | The three starter recipes, and No saved recipes yet. Showing the starter recipes. |
| Version 2, saved after Sam adds Pea and mint soup | All four recipes after a reload, with their ingredients and the count per category |
Damaged, so JSON.parse() throws a SyntaxError |
The three starter recipes, and Your saved recipes were damaged. Showing the starter recipes. |
| Version 1, from Sam’s kitchen laptop, with no version number | Its two recipes, upgraded to version 2 as they load, each with No ingredients yet |