An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

[![version](https://img.shields.io/npm/v/@zikwall/use-localforage)](https://www.npmjs.com/package/@zikwall/use-localforage)
[![tests](https://github.com/zikwall/use-localforage/workflows/tests/badge.svg)](https://github.com/zikwall/use-localforage/actions)
[![downloads](https://img.shields.io/npm/dw/@zikwall/use-localforage)](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`