How to store / save data in

How to save / save data in native response . As we use common preferences in android, is there any solution for the native.I reaction I am new to reaction-nactive.

add example example

+4
source share
2 answers

You can use React Native AsyncStorage to store data on the device’s local storage.

import { AsyncStorage } from 'react-native'

Use this to save data.

AsyncStorage.setItem('key', 'value');

AsyncStorage only accepts a value as string , so you may need to use stringify()AsyncStorage before setting it.

And to retrieve data use

AsyncStorage.getItem('your key'); 
+8

React Native , npm : npm install react-native-shared-preferences --save. ( ) : https://www.npmjs.com/package/react-native-shared-preferences

+4

Source: https://habr.com/ru/post/1672898/


All Articles