@gulibs/react-storage
TypeScript icon, indicating that this package has built-in type declarations

0.0.5 • Public • Published

React Stroage

带过期时间的本地存储

NPM

安装

npm install --save @gulibs/react-storage

or

yarn add @gulibs/react-storage

使用

import { ReactStorage } from '@gulibs/react-storage';

const App: React.FC = ()=> {

    const storage = ReactStorage.getInstance();

    useEffect(()=> {
        storage.type = 'sessionStorage';
        storage.type = 'localStorage';
        storage.set('hello', '你好');
        console.log('get', storage.get('hello'));
        console.log("getKeys", storage.getKeys());
        storage.remove('test');
        storage.removeExpired();
        storage.removeAll();
    }, []);
    ...
}

Readme

Keywords

Package Sidebar

Install

npm i @gulibs/react-storage

Weekly Downloads

0

Version

0.0.5

License

MIT

Unpacked Size

10.3 kB

Total Files

8

Last publish

Collaborators

  • gujiwen