https://github.com/zikwall/use-localforage
React Hook for localForage - improves the offline experience of your web app by using asynchronous storage (IndexedDB or WebSQL) with a simple, localStorage-like API
https://github.com/zikwall/use-localforage
hook localforage react typescript
Last synced: about 1 year ago
JSON representation
React Hook for localForage - improves the offline experience of your web app by using asynchronous storage (IndexedDB or WebSQL) with a simple, localStorage-like API
- Host: GitHub
- URL: https://github.com/zikwall/use-localforage
- Owner: zikwall
- Created: 2021-01-11T11:14:32.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-01-12T09:03:01.000Z (over 5 years ago)
- Last Synced: 2025-04-01T16:24:05.499Z (about 1 year ago)
- Topics: hook, localforage, react, typescript
- Language: TypeScript
- Homepage:
- Size: 79.1 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://www.npmjs.com/package/@zikwall/use-localforage)
[](https://github.com/zikwall/use-localforage/actions)
[](https://www.npmjs.com/package/@zikwall/use-localforage)
use localForage
localForage is a fast and simple storage library for JavaScript
### Installation
- `$ yarn add @zikwall/use-localforage`
### How to use
```typescript jsx
import { useLocalForage } from "@zikwall/use-localforage";
interface User {
name: string;
lastname: string;
age: number;
}
function App() {
const [ userValue, setUserValue, removeUserValue ] = useLocalForage('user', {...});
let onUpdate = () => {
setUserValue({...});
};
let onRemove = () => {
removeUserValue();
};
return (
Click for update user properties
Click for remove user properties
Name is: {userValue?.name}
Lastname is: {userValue?.lastname}
Age is: {userValue?.age}
);
}
```
### Tests
- `$ yarn test`