Skip to content

Commit

Permalink
[@mantine/hooks] use-local-storage: Fix value not being updated when …
Browse files Browse the repository at this point in the history
…`key` changes (#7286)
  • Loading branch information
rtivital committed Dec 23, 2024
1 parent 58a2e2b commit 358c3dd
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export function createStorage<T>(type: StorageType, hookName: string) {
useEffect(() => {
const val = readStorageValue();
val !== undefined && setStorageValue(val);
}, []);
}, [key]);

return [value === undefined ? defaultValue : value, setStorageValue, removeStorageValue] as [
T,
Expand Down

0 comments on commit 358c3dd

Please sign in to comment.