Skip to content

Latest commit

 

History

History
18 lines (14 loc) · 503 Bytes

File metadata and controls

18 lines (14 loc) · 503 Bytes

mobx-persist-store wrapper

If you want to use MMKV with mobx-persist-store, create the following storage object:

import { configurePersistable } from 'mobx-persist-store'
import { createMMKV } from "react-native-mmkv"

const storage = createMMKV()

configurePersistable({
  storage: {
    setItem: (key, data) => storage.set(key, data),
    getItem: (key) => storage.getString(key),
    removeItem: (key) => storage.remove(key),
  },
})