@searchspring/snap-store-mobx
TypeScript icon, indicating that this package has built-in type declarations

0.56.4 • Public • Published

Snap MobX Store

NPM Status

Management of Snap state using Mobx.

Dependency

Snap Store MobX is a dependency of @searchspring/snap-controller NPM Status

Dependencies

Snap Store MobX requires the following dependencies as services:

NPM Status @searchspring/snap-url-manager

Installation

npm install --save @searchspring/snap-store-mobx

Import

import { AbstractStore, SearchStore, AutocompleteStore, FinderStore, RecommendationStore, StorageStore } from '@searchspring/snap-store-mobx';

Controller usage

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.

Standalone usage

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());

Readme

Keywords

none

Package Sidebar

Install

npm i @searchspring/snap-store-mobx

Weekly Downloads

4,248

Version

0.56.4

License

MIT

Unpacked Size

370 kB

Total Files

183

Last publish

Collaborators

  • searchspring-nebo
  • kevindevin