Skip to content

Latest commit

 

History

History
18 lines (14 loc) · 495 Bytes

WRAPPER_MOBX.md

File metadata and controls

18 lines (14 loc) · 495 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 { MMKV } from "react-native-mmkv"

const storage = new MMKV()

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