Closed dinwwwh closed 4 months ago
const [manager, setManager] = useLocalStorage<'npm' | 'pnpm' | 'yarn'>('package-manager', 'pnpm')
Expected:
manager
cannot be null when I set initial value Actual:manager
can be null
Here is the corrected and enhanced version of your statement:
Could you provide a minimal reproduction of the issue, either on CodeSandbox or StackBlitz? Without a minimal reproduction, I can't pinpoint the exact problem you're encountering.
const [manager, setManager] = useLocalStorage<'npm' | 'pnpm' | 'yarn'>('package-manager', 'pnpm')
Expected:
manager
cannot be null when I set initial value Actual:manager
can be nullHere is the corrected and enhanced version of your statement:
Could you provide a minimal reproduction of the issue, either on CodeSandbox or StackBlitz? Without a minimal reproduction, I can't pinpoint the exact problem you're encountering.
I don't think we need a minimal reproduction, because this is actual current behavior of useLocalStorage
hooks.
Can the behavior value be null
even when I set the initial value as expected?
@dinwwwh I've improved the types of useLocalStorage
in https://github.com/SukkaW/foxact/commit/3c4515e9cb5e6d7ac19cfe3ba157dd221409b076. Now when the serverValue
is provided the state will not be null
.
Expected:
manager
cannot be null when I set initial value Actual:manager
can be null