chocokai
chocokai2y ago

✅ – kairu – 16-47 Oct 31

is there a better way to do
JSON.parse(JSON.stringify(localStorage.getItem('user')))
JSON.parse(JSON.stringify(localStorage.getItem('user')))
?
7 Replies
Louis
Louis2y ago
Why do you need to stringify the value in local storage? It's a key value pair so I imagine you'd be storing a stringified JSON object as the value here anyway
chocokai
chocokai2y ago
it wouldn't let me parse through it without running stringify then parse and saving the object in local storage would only return object Object
Louis
Louis2y ago
You should stringify it before persisting it and parse it after retrieving it
chocokai
chocokai2y ago
OK i'll that that real quick
reactibot
reactibot2y ago
This question has an answer! Thank you for helping 😄 If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/565213527673929729/1036682879910039554
Louis
Louis2y ago
Awesome meowthumbsup
reactibot
reactibot2y ago
This thread hasn’t had any activity in 12 hours, so it’s now locked. Threads are closed automatically after 12 hours. If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/565213527673929729/1036682879910039554