Ontime Connect
What is an Ontime Component? There are the Decorator and Store, who are able to help you not to use complex functionality as Redux or MobX. Sometimes there is a need for small and simple functionality that covers the same functionality form Redux or MobX.
The store is used to help you manage application state container.
Decorator @Connect is used to react to changes in Store.
Below you are able to find example how to use.
How to install
npm install ontime-connect
How to use
// File store.ts; ; ;
// File UserComponent.ts;;;
Store methods
set
set(name: keyof P, value: P[keyof P]): void
Set a new value to store
where "P" is generic interface of properties
get
get(name: keyof P): P[keyof P]
get value by name from store
@Connect
Connect<P>(store: Store<P>, propsName: string[])
create connection from component to store
P - generic interface of properties
store - instance of class Store
propsName - list of properties names to react on changes