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
2
2
3
- Asynchronous , persistent, key-value storage system for React Native.
3
+ An asynchronous , persistent, key-value storage system for React Native.
4
4
5
- ## Getting started
6
5
6
+ ## Getting Started
7
7
8
- ### Install
9
8
10
- ` yarn add @react-native-community/async-storage `
9
+ ```
10
+ # Install
11
+ $ yarn add @react-native-community/async-storage
11
12
12
- or
13
+ # Link
14
+ $ react-native link @react-native-community/async-storage
15
+ ```
13
16
14
- ` npm install @react-native-community/async-storage --save `
17
+ See docs for [ manual linking guide. ] ( docs/Linking.md )
15
18
16
19
17
- ### Link
20
+ ## Usage
18
21
19
- ` react-native link @react-native-community/async-storage `
22
+ ### Import
20
23
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 )
22
58
23
- ToDo
59
+ ## License
24
60
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