use-state-advanced
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

useStateAdvanced

A set of useState hooks and tools

Installation

npm i use-state-advanced

At the moment there are two hooks these are useStateAdvanced and useLocalStorage

Numeric keys are passed through a dash at the beginning of shelf-5 and shelf-2 and the like

How to useStateAdvanced

import { useStateAdvanced } from 'use-state-advanced'

const [state, setState] = useStateAdvanced({ user: { books: { shelf: {...and the like} } } });

setState('user.books.shelf-5.name.garypotter.title', data);
// user["books"]["shelf][5]["name"]["garipoter"]["title"]

How to useLocalStorage

import { useLocalStorage } from 'use-state-advanced'

const [state, setState] = useLocalStorage('myKey', { user: { books: { shelf: {...and the like} } } });

setState('user.books.shelf-5.name.garypotter.title', data);
// user["books"]["shelf][5]["name"]["garipoter"]["title"]

Package Sidebar

Install

npm i use-state-advanced

Weekly Downloads

1

Version

1.0.5

License

MIT

Unpacked Size

2.77 kB

Total Files

6

Last publish

Collaborators

  • illuminat