When you call the setter with null (or undefined), the hook correctly removes the item from storage—but because of the fallback logic, it then returns the original initialValue instead of null (or undefined).
Steps to reproduce:
Install @uidotdev/usehooks
In your component:
const [value, setValue] = useLocalStorage<string>('foo', 'default');
setValue(null);
Observe that localStorage.getItem('foo') is removed, yet value === 'default'
Expected behavior:
After removal, the hook’s state should be null (or undefined), regardless of what initialValue was.
Actual behavior:
The hook returns initialValue whenever the stored item is missing.