Skip to content

useLocalStorageValue yields undefined on firstRender if initializeWithValue not set #1002

Description

@Evalon

What is the current behavior?

useLocalStorageValue yields undefined on first render if initializeWithValue not set to true and on second render yield actual value from localStorage.

https://codesandbox.io/s/wispy-forest-qmrlzn?file=/src/App.tsx

What is the expected behavior?

initializeWithValue: true should be default behavior based on documentation and previous behaviour.

Environment Details

  • _@react-hookz/web version: 17.0
  • _react version: 18.2
  • _react-dom version: 18.2
  • _typescript version: 4.8.4
  • _OS: macos
  • _Browser: chrome
  • _Did this work in previous versions? yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions