Closed dheerajvs closed 8 years ago
localForage has: getItem(), setItem(), removeItem()
the built-in AsyncStorage adapter should work for you
Hi @dheerajvs, @vicentedealencar is right; the AsyncStorage adapter should work. You can do the following to get going:
import adapter from 'redux-localstorage/lib/adapters/AsyncStorage';
const storage = adapter(localForage);
I will add it to the list of adapters though to prevent confusion and help others find what they're looking for.
Thanks for the clarification. You may close this issue.
Just realised there is an important difference between AsyncStorage and localForage; AsyncStorage only stores string values, whereas localForage accepts any type of value. The JSON.stringify/parse that's part of the AsyncStorage adapter therefore posses an issue. Which, in a sense, is a similar issue as the one raised in PR #16.
@elgerlambert I'd say just add a new adapter for localForage instead of trying to stuff it into AsyncStorage. Since not all storages limit their data to be strings, JSON.stringify()/.parse() should not be considered as a default part of all async storages.
1.0.0-rc5 includes an adapter for localForage!
Hello ! Somebody can tell me why I do not have any folder named "adapters" in redux-localstorage/lib/ ? What I did wrong ?
Thanks !
Hi @idwd,
Make sure you npm install redux-localstorage@rc --save
. The @latest (0.4.1) doesn't have adapters.
Please provide a built-in adapter for Mozilla's localForage.