Hi, any advice to create a temporal favorite items list. So the user can save a favorite list from a list of items but the user is not logged in.
Regards
Hi, any advice to create a temporal favorite items list. So the user can save a favorite list from a list of items but the user is not logged in.
Regards
You can add an array element to the page, add the items to the array and push the array to local storage.
How to push it to local storage??I never have done that.
Without having a user authentication and storing the favorites in a database your efforts will be wasted as any other method will only be temporary. Once a user clears their browser its all gone.
Storing in a database is the only way to do this effectively.
You could store a cookie containing a record ID. Then store their favourites in the database linked by that ID. You could even have something like a UUID in the cookie to stop people getting lists from other IDs.
Also, local storage (Data Store) is persistent so it is kept even after closing the browser or rebooting the computer.