diff options
Diffstat (limited to 'modern/src/common/util/usePersistedState.js')
-rw-r--r-- | modern/src/common/util/usePersistedState.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/modern/src/common/util/usePersistedState.js b/modern/src/common/util/usePersistedState.js index 8bc4401f..70a652ad 100644 --- a/modern/src/common/util/usePersistedState.js +++ b/modern/src/common/util/usePersistedState.js @@ -11,7 +11,11 @@ export default (key, defaultValue) => { }); useEffect(() => { - savePersistedState(key, value); + if (value !== defaultValue) { + savePersistedState(key, value); + } else { + window.localStorage.removeItem(key); + } }, [key, value]); return [value, setValue]; |