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
#Local Storage on movie watchlist solo project
1 messages · Page 1 of 1 (latest)
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