Skip to content

Commit

Permalink
Merge pull request #274 from unfernandito/patch-1
Browse files Browse the repository at this point in the history
docs: update usage of MMKVLoader in readme
  • Loading branch information
ammarahm-ed authored Aug 4, 2022
2 parents 75ff4fe + 279f724 commit 01edd65
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ Hooks let's the storage update your app when a change takes place in storage.
Starting from `v0.5.5`, thanks to the power of JSI, we now have our very own `useMMKVStorage` Hook. Think of it like a persisted state that will always write every change in storage and update your app UI instantly. It doesn't matter if you reload the app or restart it.

```js
import MMKVStorage, { useMMKVStorage } from 'react-native-mmkv-storage';
import { MMKVLoader, useMMKVStorage } from 'react-native-mmkv-storage';

const storage = new MMKVStorage.Loader().initialize();
const storage = new MMKVLoader().initialize();
const App = () => {
const [user, setUser] = useMMKVStorage('user', storage, 'robert');
const [age, setAge] = useMMKVStorage('age', storage, 24);
Expand Down Expand Up @@ -126,7 +126,7 @@ MMKV supports concurrent read-read and read-write access between processes. This
You can create many database instances. This helps greatly if you have separate logics/modules in the same app that use data differently, It also helps in better performance since each database instance is small instead of a single bulky database which makes things slower as it grows.

```js
const userStorage = new MMKVStorage.Loader()
const userStorage = new MMKVLoader()
.withEncryption()
.withInstanceID('userdata')
.initialize();
Expand All @@ -139,7 +139,7 @@ const settingsStorage = new MMKVStorage.Loader().withInstanceID('settings').init
The library supports full encryption (AES CFB-128) on Android and iOS. You can choose to store your encryption key securely for continuious usage. The library uses Keychain on iOS and Android Keystore on android (API 23 and above). Encrypting an instance is simple:

```js
const storage = new MMKVStorage.Loader()
const storage = new MMKVLoader()
.withEncryption() // Generates a random key and stores it securely in Keychain
.initialize();
```
Expand Down

1 comment on commit 01edd65

@vercel
Copy link

@vercel vercel bot commented on 01edd65 Aug 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

rnmmkv – ./

rnmmkv.vercel.app
rnmmkv-git-master-ammarahm-ed.vercel.app
rnmmkv-ammarahm-ed.vercel.app

Please sign in to comment.