#Local Storage on movie watchlist solo project

1 messages · Page 1 of 1 (latest)

naive carbon
#

Hi ! I am working on the movie watchlist project. Initially, the selected data are stored in local storage and rendered in watchlist, but when I search for new movies and add new data to local storage, the previously saved data in local storage are deleted ( so in the watchlist) and the new data are added to it.
Here is my scrim link https://scrimba.com/scrim/cGZvqLt8

Scrimba

Learn to code with interactive screencasts. Our courses and tutorials will teach you React, Vue, Angular, JavaScript, HTML, CSS, and more. Scrimba is the fun and easy way to learn web development.

cobalt haven
#

That's because you never initialize your myWatchlist array with the contents of localStorage initially... so when you push a new movie, it's the only one in the list and then you update localStorage with ONLY the new movie data - this erases the old data.

#

in fact your storedData variable, which contains the localStorage information is never even used... instead you should be putting that content into movieList