react-native-session-storage
TypeScript icon, indicating that this package has built-in type declarations

1.3.4 • Public • Published

react-native-session-storage

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

npm version npm bundle size License Android iOS Web GitHub issues

This module is NOT an alternative for Async Storage which is meant for persistent storage. Instead, this module provides a "volatile" session-bound 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

Package Sidebar

Install

npm i react-native-session-storage

Weekly Downloads

267

Version

1.3.4

License

MIT

Unpacked Size

13.2 kB

Total Files

12

Last publish

Collaborators

  • futurejj