- updated internal docs;
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
// stores
|
// store API
|
||||||
import { mainStore } from './main';
|
import { mainStore } from './main';
|
||||||
import {
|
import {
|
||||||
useStoreValue as useStoreValueOriginal,
|
useStoreValue as useStoreValueOriginal,
|
||||||
@@ -6,19 +6,19 @@ import {
|
|||||||
useTracked
|
useTracked
|
||||||
} from 'zustand-x';
|
} from 'zustand-x';
|
||||||
|
|
||||||
// migration: useStore -> useStoreValue
|
// Hook. Subscribe to single store value with arguments
|
||||||
// old: useStore().main.getRole() -- new: useStoreValue('getRole')
|
|
||||||
export const useStoreValue = (key, ...args) => useStoreValueOriginal(mainStore, key, ...args);
|
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);
|
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);
|
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);
|
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 const storeSet = (key, ...args) => mainStore.set(key, ...args);
|
||||||
|
|
||||||
export default mainStore;
|
export default mainStore;
|
||||||
Reference in New Issue
Block a user