1.2.3 • Published 4 years ago

bjork_usestorage v1.2.3

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

What is this?

A React hook used for managing state and Storage simultaneously, effortlessly.

Install

Use npm to install bjork_useStorage or copy the code manually form github.

> npm i bjork_useStorage

Usage

Utilizes and, therefor, functions like Reacts useState. However, useStorage also take three params: 1. type (string). Which only accepts one of three strings "local", "session" or "cookie". 2. key (string) 3. initalValue (@default "").

The returned "set" takes two parameters, key and value. Also, if the chosen type is cookie, then the returned "set" also takes an optional third parameter that configures how the cookie is packaged, for more information check out the dependency bjork_cookie.

> import useStorage from 'bjork_usestorage'
>
> const [ state, setState ] = useStorage(type, key, initalvalue?)

Contribution

Pull requests are welcome. For any considerable changes, please open an issue first to discuss what you would like to change.

Licence

MIT

1.2.3

4 years ago

1.2.2

4 years ago

1.2.0

4 years ago

1.2.1

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago