Managing custom state - XMPieLab/uStore-NG GitHub Wiki
As mentioned in the uStore library page, you can manage the custom state that will be preserved throughout the application.
Using the custom state you can save data in one page and use it in another page. You can set/get data from the custom state through the UStoreProvider object.
Usage
To use the custom state, import the UStoreProvider object:
import {UStoreProvider} from '@ustore/core'
Example of getting custom data (access the _currectCategory _object):
let {currentCategory} = UStoreProvider.state.customState.get()
console.log('name of the current category', currentCategory.Name)
Example of setting custom data (set _categoryTree _object with 'categoryTree' key):
const currentCategory = {
Name: 'Business cards',
ID:'f48af9ba-54e9-4640-b0df-e4380fc507a8'
}
UStoreProvider.state.customState.set('currentCategory',currentCategory)