function useCreateStore<T>(getValue): ReadonlyStore<T>;
function useCreateStore<T>(getValue): ReadonlyStore<T>;
Defined in: packages/react-store/src/useCreateStore.ts:24
Creates a stable store instance for the lifetime of the component.
Pass an initial value to create a writable store, or a getter function to create a readonly derived store. This hook mirrors the overloads from createStore, but ensures the store is only created once per mount.
T
(prev?) => T
ReadonlyStore<T>
const counterStore = useCreateStore({ count: 0 })
const counterStore = useCreateStore({ count: 0 })
function useCreateStore<T>(initialValue): Store<T>;
function useCreateStore<T>(initialValue): Store<T>;
Defined in: packages/react-store/src/useCreateStore.ts:27
Creates a stable store instance for the lifetime of the component.
Pass an initial value to create a writable store, or a getter function to create a readonly derived store. This hook mirrors the overloads from createStore, but ensures the store is only created once per mount.
T
T
Store<T>
const counterStore = useCreateStore({ count: 0 })
const counterStore = useCreateStore({ count: 0 })
function useCreateStore<T, TActions>(initialValue, actions): Store<T, TActions>;
function useCreateStore<T, TActions>(initialValue, actions): Store<T, TActions>;
Defined in: packages/react-store/src/useCreateStore.ts:28
Creates a stable store instance for the lifetime of the component.
Pass an initial value to create a writable store, or a getter function to create a readonly derived store. This hook mirrors the overloads from createStore, but ensures the store is only created once per mount.
T
TActions extends StoreActionMap
NonFunction<T>
StoreActionsFactory<T, TActions>
Store<T, TActions>
const counterStore = useCreateStore({ count: 0 })
const counterStore = useCreateStore({ count: 0 })
Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.