type
프로퍼티를 가지고 있다.export class FeedAnimals {
static readonly type = '[Zoo] Feed Animals';
}
export class FeedZebra {
static readonly type = '[Zoo] Feed Zebra';
constructor(public name: string, public hayAmount: number){}
}
command
ex)
Event examples
이벤트는 이미 일어난 액션이다. 그리고 이벤트들에 반응해야한다.
commands와 다른 convention을 적용한다.
(주로 API 요청에 의해 발생하는 것을 의미하는 듯)
ex)
출처: Good Action Hygiene with ngrx
액션을 Group지을 때는 접미사를 사용하지말고 namespace를 사용하라
export namespace Todo {
export class Add {
static readonly type = '[Todo] Add';
constructor(public payload: any) {}
}
export class Edit {
static readonly type = '[Todo] Edit';
constructor(public payload: any) {}
}
export class FetchAll {
static readonly type = '[Todo] Fetch All';
}
export class Delete {
static readonly type = '[Todo] Delete';
constructor(public id: number) {}
}
}
출처 : NGXS 공식문서