0.1.1 • Published 2 years ago

@dash-media/use-persistent-state v0.1.1

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

usePersistentState

How to use

const [state, setState] = usePersistentState(initialState, componentID);

Use state

Everything here is exactly how useState works, except for what will be explained in the next section:

Component ID

Component ID is the tag that your state will be stored under in localStorage. Other than this, usePersistentState acts exactly like useState in react.

Supported Data Types

All data that is serialisable is available for use in usePersistentState. The only addition to this is Dates. Dates can't be included inside of objects for now. In future I may add the option of including SuperJSON as a transformer.

0.1.1

2 years ago

0.1.0

2 years ago