DEV Community

Discussion on: Web Storage API

Collapse
lionelrowe profile image
lionel-rowe • Edited on

Session storage - It should be used when you need to store something that changes frequently.
Local storage - It should be used for long term use where data won't get changed often.

I don't see why this should be the case. The use cases for each have nothing to do with frequency of changes and everything to do with whether the data needs to persist between tab sessions.

For very frequent writes, especially if they involve large volumes of data, IndexedDB is a better tool as it's asynchronous (non-blocking) and can store many types of structured data without serializing them first.

Unfortunately the IndexedDB API is horrendously designed, so a tiny wrapper library such as idb is advisable.

Collapse
naveenchandar profile image
Naveenchandar Author

Thanks for the insight 🙂.

Some comments have been hidden by the post's author - find out more