diff --git a/packages/react/react/src/hooks/useStorageState.ts b/packages/react/react/src/hooks/useStorageState.ts index 5c9be10f..69f1fdf3 100644 --- a/packages/react/react/src/hooks/useStorageState.ts +++ b/packages/react/react/src/hooks/useStorageState.ts @@ -90,6 +90,12 @@ export function useStorageState( setState(getValue() ?? defaultValue); }, [defaultValue, getValue]); + useEffect(() => { + if (defaultValue != null) { + set(getValue()); + } + }, [set, getValue, defaultValue]); + return [state, set, refresh] as const; }