A minimalistic wrapper around React Native's AsyncStorage.
npm install react-native-simple-store
import store from 'react-native-simple-store';
store
.save('coffee', {
isAwesome: true
})
.then(() => store.get('coffee'))
.then(coffee => {
console.assert(coffee.isAwesome === true);
})
.then(() => store.update('coffee', {
isNotEssential: false
}))
.then(() => store.get('coffee'))
.then(coffee => {
console.assert(coffee.isNotEssential === false);
console.assert(coffee.isAwesome === true);
return store.delete('coffee');
})
.then(() => store.get('coffee'))
.then(coffee => {
console.assert(coffee === null);
})
.catch(error => {
console.error(error.message);
});
MIT