[Vuejs]-How to update object in local storage in vue js?

3👍

You can store data like this.

localStorage.setItem(USER_INFO, JSON.stringify(userData));

You can read, update and store again.

const userData = JSON.parse(localStorage.getItem(USER_INFO));
userData.unread_notifications = ...
localStorage.setItem(USER_INFO, JSON.stringify(userData));
👤Prime

Leave a comment