react-native-session-storage
v1.3.2
Published
Session Storage like module for React Native for session-bound storage.
Downloads
635
Maintainers
Readme
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" 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