Skip to content

MillerGregor/redux-persist-fs-storage

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Redux Persist FS Storage

Redux Persist storage engine for React Native file system

Inspired by redux-persist-filesystem-storage, this module works as adapter between react-native-fs and redux-persist.

Install

yarn add react-native-fs redux-persist-fs-storage

This will install react-native-fs as dependency. So make sure to link it natively:

react-native link react-native-fs

See react-native-fs's documentation for details.

Usage

import { persistStore } from 'redux-persist'
import FSStorage from 'redux-persist-fs-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-fs-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.

About

Redux Persist storage engine for React Native file system

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%