rt2zz / redux-persist

persist and rehydrate a redux store
MIT License
12.91k stars 863 forks source link

How does redux-persist listen for localstorage changes #1337

Closed lalLAL95828 closed 2 years ago

lalLAL95828 commented 2 years ago

When two pages are opened, one page changes the value of localstorage. How does the other page listen for changes

ckalika commented 2 years ago

@lalLAL95828 Check out the example of the storage event here: https://developer.mozilla.org/en-US/docs/Web/API/Window/storage_event

This isn't a project-specific question, but I've added it as a TODO to add as a code sample relating to redux-persist, as it's likely useful.