- updated internal docs;
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// stores
|
||||
// store API
|
||||
import { mainStore } from './main';
|
||||
import {
|
||||
useStoreValue as useStoreValueOriginal,
|
||||
@@ -6,19 +6,19 @@ import {
|
||||
useTracked
|
||||
} from 'zustand-x';
|
||||
|
||||
// migration: useStore -> useStoreValue
|
||||
// old: useStore().main.getRole() -- new: useStoreValue('getRole')
|
||||
// Hook. Subscribe to single store value with arguments
|
||||
export const useStoreValue = (key, ...args) => useStoreValueOriginal(mainStore, key, ...args);
|
||||
|
||||
// Hook. Subscribe to the whole store (use ONLY if really needed (probably will not be needed though!))
|
||||
export const useStoreState = (key, ...args) => useStoreStateOriginal(mainStore, key, ...args);
|
||||
|
||||
// migration: useTrackedStore -> useTrackedValue
|
||||
// Hook. Subscribe to single store value no arguments
|
||||
export const useTrackedValue = (key) => useTracked(mainStore, key);
|
||||
|
||||
// old: storeGet.main.getRole() -- new: storeGet('getRole')
|
||||
// NOT hook. Get store value.
|
||||
export const storeGet = (key, ...args) => mainStore.get(key, ...args);
|
||||
|
||||
// old: storeSet.main.removeElement(id) -- new: storeSet('removeElement', id)
|
||||
// NOT hook. Set store value
|
||||
export const storeSet = (key, ...args) => mainStore.set(key, ...args);
|
||||
|
||||
export default mainStore;
|
||||
Reference in New Issue
Block a user