Skip to content

softsuave-tech-matrix/rn-persistor

Repository files navigation

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

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published