node package manager

react-native-simple-store

React Native Simple Store

Code Climate Build Status npm version npm

A minimalistic wrapper around React Native's AsyncStorage.

Installation

npm install react-native-simple-store

API Reference

Example Usage

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);
  });

License

MIT