2.0.0-rc.0 • Published 4 years ago

@react-native-community/async-storage-backend-web v2.0.0-rc.0

Weekly downloads
3,535
License
MIT
Repository
-
Last release
4 years ago

Storage Backend: Web

An AsyncStorage backend, targeting web platform. Uses either localStorage or sessionStorage.

Installation

$ yarn add @react-native-community/async-storage@next

$ yarn add @react-native-community/async-storage-backend-web@next

Usage

import WebStorage from '@react-native-community/async-storage-backend-web';
import AsyncStorageFactory from '@react-native-community/async-storage';

type MyModel = {};


const webStorage = new WebStorage(true);

const storage = AsyncStorageFactory.create<MyModel>(webStorage);


export default storage;

Options

WebStorage accepts a single boolean argument, deciding if sessionStorage should be used instead of localStorage. Default is false.

License

MIT.