stencil-prop-store-sync
Version:
A Stencil decorator for synchronizing @Prop and @State changes with a store, so you don't have to worry about prop drilling.
17 lines (14 loc) • 601 B
TypeScript
import * as _stencil_store from '@stencil/store';
import { ComponentInterface } from '@stencil/core';
/**
* Creates a Stencil store instance as well as a typed `@SyncWithStore` decorator
* that you can use to sync component properties with the store's state.
* @param initialState The initial state of the store
*/
declare function createStoreSync<StoreType extends {
[key: string]: any;
}>(initialState: StoreType): {
store: _stencil_store.ObservableMap<StoreType>;
SyncWithStore: () => (proto: ComponentInterface, propName: keyof StoreType) => void;
};
export { createStoreSync };