1 min read

Add persistence to local storage for an existing app

Here's a simple shopping list app - https://codesandbox.io/p/sandbox/shopping-list-local-storage-76f46c. Right now if the user refreshes the page, all the data is lost.
Improve the app by saving the data to local storage, so the user doesn't lose his items.

Acceptance criteria:

  • When the user changes the items in the shopping list, the list is updated in local storage as well
  • When the user refreshes the page, the items are still there

Notes:

  • the app doesn't need to work across multiple tabs (but you can give it a shot if you want!)
  • you don't need to create a custom hook (but you can try this other practice exercise if you want to try that)
💡
Ready to check your work?
Become a member and get access to the official solution and the comments section for feedback and discussion.

Get the React Practice Calendar!

28 days of focused practice of increasing difficulty, going through everything from Fundamentals, Data fetching, Forms and using Intervals in React.

You will also get notified whenever a new challenge is published.