capacitor-community / react-hooks

⚡️ React hooks for Capacitor ⚡️
Other
246 stars 22 forks source link

feat(useStorageItem): allow to update state using previous value like… #8

Open slevy85 opened 4 years ago

slevy85 commented 4 years ago

… React setState.

This allow to use all useState features available. The storage is updated asynchronously with this effect.

slevy85 commented 4 years ago

I added a fix to give the correct type of the stored value, based on the initialValue. This should fix #4 .