File tree Expand file tree Collapse file tree 3 files changed +54
-11
lines changed Expand file tree Collapse file tree 3 files changed +54
-11
lines changed Original file line number Diff line number Diff line change 1- # react-native-async-storage
1+ # React Native Async Storage
22
3- Asynchronous , persistent, key-value storage system for React Native.
3+ An asynchronous , persistent, key-value storage system for React Native.
44
5- ## Getting started
65
6+ ## Getting Started
77
8- ### Install
98
10- ` yarn add @react-native-community/async-storage `
9+ ```
10+ # Install
11+ $ yarn add @react-native-community/async-storage
1112
12- or
13+ # Link
14+ $ react-native link @react-native-community/async-storage
15+ ```
1316
14- ` npm install @react-native-community/async-storage --save `
17+ See docs for [ manual linking guide. ] ( docs/Linking.md )
1518
1619
17- ### Link
20+ ## Usage
1821
19- ` react-native link @react-native-community/async-storage `
22+ ### Import
2023
21- ## Usage
24+ ``` js
25+ import AsyncStorage from ' @react-native-community/async-storage' ;
26+ ```
27+
28+ ### Store data
29+ ``` jsx
30+
31+ storeData = async () => {
32+ try {
33+ await AsyncStorage .setItem (' @storage_Key' , ' stored value' )
34+ } catch (e) {
35+ // saving error
36+ }
37+ }
38+
39+ ```
40+
41+ ### Read data
42+ ``` jsx
43+
44+ getData = async () => {
45+ try {
46+ const value = await AsyncStorage .getItem (' @storage_Key' )
47+ if (value !== null ) {
48+ // value previously stored
49+ }
50+ } catch (e) {
51+ // error reading value
52+ }
53+ }
54+
55+ ```
56+
57+ See docs for [ api and more examples.] ( docs/API.md )
2258
23- ToDo
59+ ## License
2460
61+ MIT
Original file line number Diff line number Diff line change 1+ # Async Storage API
Original file line number Diff line number Diff line change 1+ # Manual Linking
2+
3+ ## iOS
4+
5+ ## Android
You can’t perform that action at this time.
0 commit comments