At first I was wondering if it works with react, but then I found it supports string values only.
So I'd recommend to add JSON serialization for set and deserialization for get.
This will be backward compatible since string serialized to JSON remain just string.
And for other cases it will greatly simplify lib usage.
Now lib is absolutely confused when non-string passed to set method, it tries to use replace method without any check and throws unhandled errors.
So to store and read simple boolean value user code will have to make a lot of frictions: toString() before set, and compare ==='true' on read.
At first I was wondering if it works with react, but then I found it supports string values only. So I'd recommend to add JSON serialization for
set
and deserialization forget
. This will be backward compatible since string serialized to JSON remain just string. And for other cases it will greatly simplify lib usage. Now lib is absolutely confused when non-string passed to set method, it tries to usereplace
method without any check and throws unhandled errors. So to store and read simple boolean value user code will have to make a lot of frictions: toString() before set, and compare ==='true' on read.