store multiple items in AsyncStoragestore multiple items in AsyncStorage

AsyncStorage is an unencrypted, asynchronous, persistent, key-value storage system that is global to the app. It should be used instead of LocalStorage.

It is recommended that you use an abstraction on top of AsyncStorage instead of AsyncStorage directly for anything more than light usage since it operates globally.

To use AsyncStorage, you have to first import it. Check out their documentation here.

 try {
      const items = [
        ['key', 'value'],
        ['key', 'value'],
        ['key', 'value'],
        ['key', 'value'],
      ];
      AsyncStorage.multiSet(items).then(() => {  
       // Do action here
      });
    } catch (error) {
       console.warn(error)
    }

How to Use Google Places AutoComplete in React Native

Looking for Mobile App Templates? Get Started with Free Mobile App Templates on origami suite

Leave a Reply

Your email address will not be published. Required fields are marked *