0.1.1 • Published 10 months ago

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

Weekly downloads
-
License
-
Repository
-
Last release
10 months 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

10 months ago

0.1.0

10 months ago