Management of Snap state using Mobx.
Snap Store MobX is a dependency of @searchspring/snap-controller
Snap Store MobX requires the following dependencies as services:
@searchspring/snap-url-manager
npm install --save @searchspring/snap-store-mobx
import { AbstractStore, SearchStore, AutocompleteStore, FinderStore, RecommendationStore, StorageStore } from '@searchspring/snap-store-mobx';
Snap Store MobX is a dependency of Snap Controller which will handle store changes as needed. As such, it is recommended to use methods of the controller to access and update the store.
import { SearchStore } from '@searchspring/snap-store-mobx'
import { UrlManager, UrlTranslator } from '@searchspring/snap-url-manager';
const searchConfig = {
id: 'search',
globals: {
pagination: {
pageSize: 12
}
}
};
const store = new SearchStore(searchConfig, { urlManager: new UrlManager(new UrlTranslator()) });
store.update(data);
// log the store
console.log(store.toJSON());