The key of the item you wish to delete from localStorage.
Checks if the event that is passed in is the same type as LocalStorageChanged.
the object you wish to assert as a LocalStorageChanged event.
if true, evt is asserted to be LocalStorageChanged.
Use this instead of directly using localStorage.setItem in order to correctly send events within the same window.
The key to write to in the localStorage.
The value to write to in the localStorage.
Generated using TypeDoc
Use this function to delete a value from localStorage.
After calling this function, the localStorage value will be null.
const user = { name: 'John', email: 'John@fakemail.com' }; // Add a user to your localStorage writeStorage('user', JSON.stringify(user)); // This will also trigger an update to the state of your component deleteFromStorage('user'); localStorage.getItem('user') === null // ✔ This is now null