redux-persist-expo-fs-secure-storage

Redux-Persist secure storage engine for Expo file system

Usage no npm install needed!

<script type="module">
  import reduxPersistExpoFsSecureStorage from 'https://cdn.skypack.dev/redux-persist-expo-fs-secure-storage';
</script>

README

Redux Persist FS Storage for Expo

Redux Persist storage engine for React Native Expo file system, this will also work for Apollo Persist.

Credits:

  • techwes for porting this to the Expo FileSystem.

Install

yarn add redux-persist-expo-fs-secure-storage

Usage

import { persistStore } from 'redux-persist'
import FSStorage from 'redux-persist-expo-fs-secure-storage';

const persistor = persistStore(store, {storage: FSStorage()});

The default storage location is a folder called reduxPersist in the document directory for your app on the device. You can specify folder for persistor:

import { persistStore } from 'redux-persist'
import FSStorage, { CacheDir } from 'redux-persist-expo-fs-secure-storage';

const cachePersistor = persistStore(store, {storage: FSStorage(CacheDir, 'myApp')});

This will create myApp folder in cache storage for iOS and Android devices. You may create multiple persistors on different directories.