ractor-angular
v1.0.4
Published
ractor state management for angular
Downloads
2
Readme
ractor-angular
安装
npm i ractor-angular
配置
@NgModule({
imports: [
BrowserModule,
StoreModule.provideStore(AppStore)
],
declarations: [
AppComponent
],
bootstrap: [AppComponent]
})
export class AppModule { }
使用
export class AppComponent implements OnInit, OnDestroy {
public value: number
public unsubscribe: () => void
constructor(public appStore: AppStore) { }
public ngOnInit() {
this.unsubscribe = this.appStore.subscribe(state => {
this.value = state.value
})
}
public ngOnDestroy() {
this.unsubscribe()
}
public increment() {
dispatch(new Increment)
}
public decrement() {
dispatch(new Decrement)
}