rn-persistor
TypeScript icon, indicating that this package has built-in type declarations

0.3.2 • Public • Published

rn-persistor

rn-persistor is a lightweight and efficient package that seamlessly integrates Realm into your React Native applications, providing a robust solution for persistent data storage. This package simplifies the integration process and allows developers to focus on building engaging user experiences

Installation

npm install rn-persistor

Install the realm dependency

npm install realm

Usage

import RealmStorage from 'rn-persistor';

const realmStorage = new RealmStorage();

//  For persistance
const persister = createAsyncStoragePersister({
    storage: realmStorage,   // pass to your storage option
  });

//  For Data storage

  async function test() {
    const key = 'token';
    await realmStorage.setItem(key, JSON.stringify('abcdefsdf54s5df4ds5f'));
    const persistedData = await realmStorage.getItem(key);
    await realmStorage.removeItem(key);
  }
  test();

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library

Package Sidebar

Install

npm i rn-persistor

Weekly Downloads

4

Version

0.3.2

License

MIT

Unpacked Size

20.2 kB

Total Files

31

Last publish

Collaborators

  • softsuave-tech-matrix