DEV Community

Cover image for How to use Local Storage in JavaScript?

How to use Local Storage in JavaScript?

Gopi Krishna on August 04, 2019

This article was originally published on my blog. Feel free to check it out Local storage allows us to store the data in the user's browser. The d...
Collapse
 
emma profile image
Emma Goto 🍙

Also if you need to let your local storage expire after a certain amount of time, store.js is a pretty useful library for local storage that lets you do that.

Collapse
 
arberbr profile image
Arber Braja

Thank you have been using localStorage in couple of projects and never used store.js. Always good to know there is such a way to make localStorage works like a cookie.

Collapse
 
v0idifier profile image
void

you can just do

localStorage.xyz = 420
delete localStorage.xyz

feels more natural.

Collapse
 
bgopikrishna profile image
Gopi Krishna

I know that, but I don't think it is a good practice to follow.