Skip to content

Storage implementation of a redux-persist storage around react-native-fs

Notifications You must be signed in to change notification settings

netbeast/redux-persist-react-native-fs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

redux-persist-react-native-fs

npm version npm downloads

React Native File System adapter for redux-persist storage. Learn more.

Installation

  1. Install react-native-fs and link it to native android, ios, etc.
npm i --save react-native-fs
react-native link react-native-fs
  1. Install this library
npm i --save redux-persist

Usage

import { NativeStorage } from 'redux-persist-react-native-fs'

/**
* For redux-persist
*/
const persistConfig = {
  storage: NativeStorage,
  // ...other config
}

export const persistor = persistStore(store, persistConfig)

/**
* Stand alone or for testing
*/
await NativeStorage.setItem('first', { test: 'common' })
await NativeStorage.setItem('nest', { of: { course: { is: 'nested' } }})
await NativeStorage.setItem('second', { of: { course: { is: 'nested' } }})
console.log({ keys: await NativeStorage.getAllKeys() })
NativeStorage.removeItem('second')
console.log({ tree: await NativeStorage.getFullTree() })
console.log({ first: await NativeStorage.getItem('first') })

About

Storage implementation of a redux-persist storage around react-native-fs

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published