-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Kevin edited this page Jan 24, 2024
·
2 revisions
The react-native-data-store module provides a convenient way to manage a data store in your React Native applications. It allows you to read, write, clear values, and even clear the entire data store.
Make sure to install the react-native-data-store package in your React Native project.
yarn add react-native-data-storenpm install react-native-data-store| Method | Description | Parameters | Returns |
|---|---|---|---|
| readDataStoreValue | Reads a value from the data store for a given key. | key: string | Promise |
| writeDataStoreValue | Writes a value to the data store for a given key. | key: string, value: string | Promise |
| clearDataStoreValue | Clears a specific value from the data store for a key. | key: string | Promise |
| clearDataStore | Clears the entire data store, removing all values. | Promise |
const myValue = await readDataStoreValue('myKey');
console.log('Value from the data store:', myValue);await writeDataStoreValue('myKey', 'Hello, Data Store!');
console.log('Value written to the data store successfully.');await clearDataStoreValue('myKey');
console.log('Value for "myKey" cleared from the data store.');await clearDataStore();
console.log('Data store cleared. All values removed.');
`