How do I update localStorage items?

前端 未结 5 2037
悲哀的现实
悲哀的现实 2021-01-18 17:55

I\'m having a problem where the cached object doesn\'t resemble the correct data so I figured it I can push up the most uptodate version to the browser cache it will solve m

5条回答
  •  广开言路
    2021-01-18 18:34

    setItem wont work instead it will create another item in localStorage with the same name

    Instead directly use

    localStorage.item = (what ever the change that you want in the item)

提交回复
热议问题