I am almost certain that i should, but i have not found any specific information on the Redux documentation. My pattern in most of my Angular components, is that i subscribe/unsubscribe to a Redux store like :
import { Component, OnInit } from '@angular/core';
@Component({
moduleId: module.id,
selector: 'selector',
templateUrl: 'name.component.html'
})
export class ComponentNameComponent implements OnInit {
private unsubscribe : Function;
constructor(@Inject(AppStore) private store: Store<AppState>) {}
ngOnInit() {
this.unsubscribe = this.store.subscribe ( ()=>{ this.updateFromState(); });
}
// Is unsubscribing onDestroy necessary?
ngOnDestroy(){
this.unsubscribe();
}
this.updateFromState(){
// ...
}
}
So i would like to know if i should always unsubscribe from the Store, and what would happen if i didn't.