March 2017
Beginner to intermediate
500 pages
9h 41m
English
Now, let's shift our attention to storing data within a React Native application. The AsyncStorage API works the same on both iOS and Android platforms. You would use this API for applications that don't require any network connectivity in the first place, or to store data that's eventually synchronized using an API endpoint once a network becomes available.
Let's look at some code that allows the user to enter a key and a value, and then stores them:
import React, { Component } from 'react'; import { AppRegistry, Text, TextInput, View, ListView, AsyncStorage, } from 'react-native'; import { fromJS } from 'immutable'; import styles from './styles'; import Button from './Button'; class StoringData extends Component { // The ...Read now
Unlock full access