It would be great to have something similar to PouchDB.
Current key-value storage (AsyncStorage
) is definitely not enough to store and query data.
To store value in local storage in React Native, we can use AsyncStorage. to call AsyncStorage. setItem with the key and value to storage the entry with the key and value. Then we call AsyncStorage.
AsyncStorage is a data storage system in React Native that is unencrypted, asynchronous, and allows users to persist data offline in React Native apps.
You can't use LocalStorage in React-Native, you can use AsyncStorage instead. Edit : You can also use a store like redux to handle this. Save data on Store on Redux is only temporal.
You may be able to use asyncstorage-down with PouchDB. Normally the method for using LevelDOWN adapters in Node.js is like so:
var PouchDB = require('pouchdb');
var db = new PouchDB('mydb', {db: require('asyncstorage-down')})
I haven't tested this, though.
Edit: well lucky you; a lot of work has been put into this recently: pouchdb-async-storage. Expect a blog post soon about how to get this working.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With