DEV Community

Discussion on: How to syncing React state across multiple tabs with useState Hook and localStorage

Collapse
 
cassiolacerda profile image
Cássio Lacerda

Your useLocalStorage custom hook written in Typescript is very interesting, congrats!

LocalStorage is really powerfull, but I have noticed that in cases with a lot of changes happening at the same time, the performance is poor, due to the excessive usage of JSON.parse and JSON.stringify. I started some tests with IndexedDB and maybe it can handle this scenario better than localStorage.