How to store an array of objects in Local Storage?

前端 未结 3 1171
迷失自我
迷失自我 2021-01-30 17:44

This is my code. I am trying since a couple of days to create an Array of Objects, which I will then store in Local Storage. Here is the problem, I need to first Get the existin

3条回答
  •  迷失自我
    2021-01-30 18:44

    See this post.

    You can't store Objects, you have to store a String. So the workaround is to stringify your Object before you store it (for example, you could use change it to a JSON object, store it, and read it again when needed).

提交回复
热议问题