JairajJangle / react-native-session-storage

Session Storage like module for react native for temporary session bound storage.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

react-native-session-storage

Session Storage like module for React Native for session-bound storage.

This module is NOT an alternative for Async Storage which is meant for persistent storage. Instead, this module provides a "volatile" storage which gets cleared when the app is re-opened.

Installation

With npm:

npm install react-native-session-storage

With yarn:

yarn add react-native-session-storage

With Expo CLI:

expo install react-native-session-storage

Usage

Importing

import SessionStorage from 'react-native-session-storage';

Storing data

The value can be of any type.

SessionStorage.setItem('@storage_key', value);

Reading data

The return value is of the type of the value which was stored using setItem(...)

const data = SessionStorage.getItem('@storage_key');

Removing data

SessionStorage.removeItem('@storage_key');

Clearing all keys

SessionStorage.clear();

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

Session Storage like module for react native for temporary session bound storage.

License:MIT License


Languages

Language:Java 42.7%Language:C++ 19.3%Language:TypeScript 14.7%Language:Objective-C++ 10.0%Language:JavaScript 4.2%Language:Makefile 4.2%Language:Ruby 3.3%Language:Objective-C 1.1%Language:C 0.3%Language:Swift 0.2%