0.0.3 • Published 2 years ago

@gulibs/react-storage v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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();
    }, []);
    ...
}
0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago