useStorage does not allow store 0 (falsey values in general)
See original GitHub issueIn my case 0
is the array index which it is rather common I think. Instead default value is used - https://github.com/antfu/vueuse/blob/master/packages/core/useStorage/index.ts#L9-L11
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
All falsey values in JavaScript - Stack Overflow
Truthy values that actually == false · "0" and '0' - they're non-empty strings, which are truthy, but Javascript's == matches numbers with...
Read more >Falsy Values in JavaScript - freeCodeCamp
A falsy value is something which evaluates to FALSE, for instance when checking a variable. There are only six falsey values in JavaScript: ......
Read more >CSC 415 Operating System Principles Unit 06 Flashcards
Which of the following is FALSE about swap space use? Select one: a. Swap space may be used to store only pages that...
Read more >useStorage - VueUse
By default, useStorage will use the value from storage if it presents and ignores the default value. Be aware that when you adding...
Read more >Falsy - MDN Web Docs Glossary: Definitions of Web-related ...
A falsy (sometimes written falsey) value is a value that is considered false when encountered in a Boolean context.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Seems to work fine - thank you!
Hi @vmihailenco, I just release a new version x.0.19.
useStorage
now supports objects and primitives, along withuseLocalStorage
anduseSessionStorage
.useStoragePlain
is no longer needed 😃