Cool, thanks for writing, But this is not a good way of persistent state, You'll get performance issues, because DOM will be blocked LS. Better is just keep the state in simple key-value object, then we can set it to storage before leaving the page, or in specific amount of time.
Why would the DOM be blocked? Maybe the main thread could be if the operation was huge, but if this is the case, you shouldn't be storing massive amounts of data in localStorage.
Yes, exactly my pointe was it's not for saving huge data, better to use do not that on each render or change or even better to use IndexedDB, Check this out it's an example of blocking the ui by localStorage, codepen.io/SitePoint/pen/GzLPJV
Well, if anything, that actually proves how capable writing to localStorage can be. The fact that it can write 100,000 entries in less than 500ms is pretty impressive. Nonetheless, each use case has its ideal solution. I wouldn’t rule out this method because of an over amplified scenario such as writing 100,000 entries to localStorage
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Cool, thanks for writing, But this is not a good way of persistent state, You'll get performance issues, because DOM will be blocked LS. Better is just keep the state in simple key-value object, then we can set it to storage before leaving the page, or in specific amount of time.
Why would the DOM be blocked? Maybe the main thread could be if the operation was huge, but if this is the case, you shouldn't be storing massive amounts of data in localStorage.
Yes, exactly my pointe was it's not for saving huge data, better to use do not that on each render or change or even better to use IndexedDB, Check this out it's an example of blocking the ui by localStorage,
codepen.io/SitePoint/pen/GzLPJV
Well, if anything, that actually proves how capable writing to localStorage can be. The fact that it can write 100,000 entries in less than 500ms is pretty impressive. Nonetheless, each use case has its ideal solution. I wouldn’t rule out this method because of an over amplified scenario such as writing 100,000 entries to localStorage