Classy Store

useLocalStore

Increment three independent counters created from the same class with useLocalStore.

Component-Scoped Counters

Each counter creates its own store on mount. Its React subscription ends on unmount.

Counter Arenders: 1
0
Counter Brenders: 1
0
Counter Crenders: 1
0

API · useLocalStore<T>(factory: () => T): T from @codebelt/classy-store/react.

Each component instance owns a store. Unmounting the component releases that instance.

On this page