Declares a persisted value once, at module scope, to share between components (usePersistedState(state)) and plain functions: state.get(), state.set(…), state.subscribe(…) and state.ready().
usePersistedState(state)
state.get()
state.set(…)
state.subscribe(…)
state.ready()
Where the value lives, its initial value, and its storage. Without attr, it stays in memory.
attr
Declares a persisted value once, at module scope, to share between components (
usePersistedState(state)) and plain functions:state.get(),state.set(…),state.subscribe(…)andstate.ready().